| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
color_filters.h
Go to the documentation of this file.
1/* color_filters.h
2 * Definitions for color filters
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10#pragma once
11#include <glib.h>
12
13#include "ws_symbol_export.h"
14
15#include <wsutil/color.h>
16#include <wsutil/wmem/wmem_list.h>
17
18#ifdef __cplusplus
19 extern "C" {
20#endif /* __cplusplus */
21
22 struct epan_dissect;
23
24#define COLORFILTERS_FILE_NAME "colorfilters"
25
26#define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___"
30
34 typedef struct _color_filter {
35 char *filter_name; /* name of the filter */
36 char *filter_text; /* text of the filter expression */
37 color_t bg_color; /* background color for packets that match */
38 color_t fg_color; /* foreground color for packets that match */
39 bool disabled; /* set if the filter is disabled */
40
41 /* only used inside of color_filters.c */
42 struct epan_dfilter *c_colorfilter; /* compiled filter expression */
43
44 /* only used outside of color_filters.c (beside init) */
45} color_filter_t;
46
53 typedef void (*color_filter_add_cb_func)(color_filter_t *colorf, void *user_data);
54
62WS_DLL_PUBLIC bool color_filters_init(char** err_msg, color_filter_add_cb_func add_cb, const char* app_env_var_prefix);
63
71WS_DLL_PUBLIC bool color_filters_reload(char** err_msg, color_filter_add_cb_func add_cb, const char* app_env_var_prefix);
72
76WS_DLL_PUBLIC void color_filters_cleanup(void);
77
83WS_DLL_PUBLIC bool color_filters_used(void);
84
90WS_DLL_PUBLIC bool tmp_color_filters_used(void);
91
98WS_DLL_PUBLIC char*
99 color_filters_get_tmp(uint8_t filt_nr);
100
109WS_DLL_PUBLIC bool
110 color_filters_set_tmp(uint8_t filt_nr, const char *filter, bool disabled, char **err_msg);
111
118WS_DLL_PUBLIC const color_filter_t *
119 color_filters_tmp_color(uint8_t filter_num);
120
127WS_DLL_PUBLIC bool
128 color_filters_reset_tmp(char **err_msg);
129
136WS_DLL_PUBLIC void color_filters_prime_edt(struct epan_dissect *edt);
137
145WS_DLL_PUBLIC bool
146 color_filters_use_hfid(int hfid);
147
155WS_DLL_PUBLIC bool
156 color_filters_use_proto(int proto_id);
157
164WS_DLL_PUBLIC const color_filter_t *
165 color_filters_colorize_packet(struct epan_dissect *edt);
166
175WS_DLL_PUBLIC const color_filter_t *
176 color_filters_colorize_packet_all(struct epan_dissect *edt,
177 wmem_allocator_t *scope, wmem_list_t **matches);
178
185WS_DLL_PUBLIC void
186 color_filter_set_session_disabled(const char *filter_name, bool disabled);
187
194WS_DLL_PUBLIC bool
195 color_filter_is_session_disabled(const char *filter_name);
196
200WS_DLL_PUBLIC void
201 color_filter_clear_session_disabled(void);
202
208WS_DLL_PUBLIC void
209 color_filter_write_paused(const char *app_env_var_prefix);
210
216WS_DLL_PUBLIC void
217 color_filter_read_paused(const char *app_env_var_prefix);
218
224WS_DLL_PUBLIC void
225 color_filter_resume_all(const char *app_env_var_prefix);
226
233WS_DLL_PUBLIC void color_filters_clone(void *user_data, color_filter_add_cb_func add_cb);
234
244WS_DLL_PUBLIC bool color_filters_import(const char *path, void *user_data, char **err_msg, color_filter_add_cb_func add_cb);
245
255WS_DLL_PUBLIC bool color_filters_read_globals(void *user_data, char** err_msg, color_filter_add_cb_func add_cb, const char* app_env_var_prefix);
256
257
265WS_DLL_PUBLIC bool color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl, char** err_msg);
266
276WS_DLL_PUBLIC bool color_filters_write(GSList *cfl, const char* app_name, const char* app_env_var_prefix, char** err_msg);
277
288WS_DLL_PUBLIC bool color_filters_export(const char *path, GSList *cfl, bool only_selected, const char* app_name, char** err_msg);
289
300WS_DLL_PUBLIC color_filter_t *color_filter_new(
301 const char *name, const char *filter_string,
302 color_t *bg_color, color_t *fg_color, bool disabled);
303
309WS_DLL_PUBLIC void color_filter_delete(color_filter_t *colorf);
310
316WS_DLL_PUBLIC void color_filter_list_delete(GSList **cfl);
317
318#ifdef __cplusplus
319}
320#endif /* __cplusplus */
321
322/*
323 * Editor modelines - https://www.wireshark.org/tools/modelines.html
324 *
325 * Local variables:
326 * c-basic-offset: 4
327 * tab-width: 8
328 * indent-tabs-mode: nil
329 * End:
330 *
331 * vi: set shiftwidth=4 tabstop=8 expandtab:
332 * :indentSize=4:tabSize=8:noTabs=true:
333 */
color.h
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, const char *app_env_var_prefix)
Read filters from the global filter file (not the users file).
Definition color_filters.c:939
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.
Definition color_filters.c:417
color_filter_add_cb_func
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).
Definition color_filters.h:53
color_filters_colorize_packet_all
WS_DLL_PUBLIC const color_filter_t * color_filters_colorize_packet_all(struct epan_dissect *edt, wmem_allocator_t *scope, wmem_list_t **matches)
Colorize a packet with ALL matching filters.
Definition color_filters.c:617
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 heade...
Definition color_filters.c:559
color_filters_reload
WS_DLL_PUBLIC bool color_filters_reload(char **err_msg, color_filter_add_cb_func add_cb, const char *app_env_var_prefix)
Reload the color filters.
Definition color_filters.c:378
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).
Definition color_filters.c:71
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.
Definition color_filters.c:985
color_filter_t
struct _color_filter color_filter_t
Data for a color filter.
color_filters_init
WS_DLL_PUBLIC bool color_filters_init(char **err_msg, color_filter_add_cb_func add_cb, const char *app_env_var_prefix)
Init the color filters (incl. initial read from file).
Definition color_filters.c:361
color_filters_tmp_color
WS_DLL_PUBLIC const color_filter_t * color_filters_tmp_color(uint8_t filter_num)
Get a temporary color filter.
Definition color_filters.c:216
color_filter_clear_session_disabled
WS_DLL_PUBLIC void color_filter_clear_session_disabled(void)
Clear all session-disabled filters.
Definition color_filters.c:684
tmp_color_filters_used
WS_DLL_PUBLIC bool tmp_color_filters_used(void)
Are there any temporary coloring filters used?
Definition color_filters.c:519
color_filters_prime_edt
WS_DLL_PUBLIC void color_filters_prime_edt(struct epan_dissect *edt)
Prime the epan_dissect_t with all the compiled color filters of the current filter list.
Definition color_filters.c:538
color_filter_set_session_disabled
WS_DLL_PUBLIC void color_filter_set_session_disabled(const char *filter_name, bool disabled)
Set a color filter as session-disabled (paused).
Definition color_filters.c:656
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.
Definition color_filters.c:163
color_filters_colorize_packet
WS_DLL_PUBLIC const color_filter_t * color_filters_colorize_packet(struct epan_dissect *edt)
Colorize a specific packet.
Definition color_filters.c:592
color_filter_delete
WS_DLL_PUBLIC void color_filter_delete(color_filter_t *colorf)
Delete a single color filter (g_free'ed).
Definition color_filters.c:248
color_filter_list_delete
WS_DLL_PUBLIC void color_filter_list_delete(GSList **cfl)
Delete a filter list including all entries.
Definition color_filters.c:267
color_filters_used
WS_DLL_PUBLIC bool color_filters_used(void)
Check if color filters are currently used.
Definition color_filters.c:513
color_filter_read_paused
WS_DLL_PUBLIC void color_filter_read_paused(const char *app_env_var_prefix)
Read paused filters from profile directory.
Definition color_filters.c:732
color_filters_apply
WS_DLL_PUBLIC bool color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl, char **err_msg)
Apply a changed filter list.
Definition color_filters.c:477
color_filter_is_session_disabled
WS_DLL_PUBLIC bool color_filter_is_session_disabled(const char *filter_name)
Check if a color filter is session-disabled.
Definition color_filters.c:675
color_filter_resume_all
WS_DLL_PUBLIC void color_filter_resume_all(const char *app_env_var_prefix)
Resume all paused filters (clears all session-disabled filters and saves to profile).
Definition color_filters.c:762
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 ...
Definition color_filters.c:582
color_filters_cleanup
WS_DLL_PUBLIC void color_filters_cleanup(void)
Cleanup remaining color filter zombies.
Definition color_filters.c:390
color_filter_write_paused
WS_DLL_PUBLIC void color_filter_write_paused(const char *app_env_var_prefix)
Write paused filters to profile directory.
Definition color_filters.c:705
color_filters_write
WS_DLL_PUBLIC bool color_filters_write(GSList *cfl, const char *app_name, const char *app_env_var_prefix, char **err_msg)
Save filters in users filter file.
Definition color_filters.c:1053
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.
Definition color_filters.c:139
color_filters_export
WS_DLL_PUBLIC bool color_filters_export(const char *path, GSList *cfl, bool only_selected, const char *app_name, char **err_msg)
Save filters (export) to some other filter file.
Definition color_filters.c:1083
color_filters_reset_tmp
WS_DLL_PUBLIC bool color_filters_reset_tmp(char **err_msg)
Reset the temporary color filters.
Definition color_filters.c:233
wmem_list_t
struct _wmem_list_t wmem_list_t
Opaque type representing a scoped, doubly-linked list in the wmem system.
Definition wmem_list.h:42
wmem_allocator_t
struct _wmem_allocator_t wmem_allocator_t
Definition wmem_core.h:44
_color_filter
Data for a color filter.
Definition color_filters.h:34
color_t
RGB color representation with 16-bit precision per channel.
Definition color.h:27
epan_dfilter
The compiled display filter object passed back to the user.
Definition dfilter-int.h:46
epan_dissect
Holds all state for the dissection of a single byte array, including session, buffer,...
Definition epan_dissect.h:28
wmem_list.h