2 * Routines for dissector-generated conversation filters for use as
3 * display and color filters
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __DISSECTOR_FILTERS_H__
13 #define __DISSECTOR_FILTERS_H__
15 #include "ws_symbol_export.h"
19 #endif /* __cplusplus */
24 /** callback function definition: is a filter available for this packet? */
25 typedef gboolean (*is_filter_valid_func)(struct _packet_info *pinfo);
27 /** callback function definition: return the available filter for this packet or NULL if no filter is available,
28 Filter needs to be freed after use */
29 typedef gchar* (*build_filter_string_func)(struct _packet_info *pinfo);
31 /** register a dissector filter */
32 WS_DLL_PUBLIC void register_conversation_filter(const char *proto_name, const char *display_name,
33 is_filter_valid_func is_filter_valid, build_filter_string_func build_filter_string);
35 WS_DLL_PUBLIC struct conversation_filter_s* find_conversation_filter(const char *proto_name);
37 /* Cleanup internal structures */
38 extern void conversation_filters_cleanup(void);
41 * Tries to build a suitable display filter for the conversation in the current
42 * packet. More specific matches are tried first (like TCP ports) followed by
43 * less specific ones (IP addresses). NULL is returned when no filter is found.
45 * The returned filter should be freed with g_free.
47 WS_DLL_PUBLIC gchar *conversation_filter_from_packet(struct _packet_info *pinfo);
49 /*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/
51 typedef struct conversation_filter_s {
52 const char * proto_name;
53 const char * display_name;
54 is_filter_valid_func is_filter_valid;
55 build_filter_string_func build_filter_string;
56 } conversation_filter_t;
58 WS_DLL_PUBLIC GList *conv_filter_list;
62 #endif /* __cplusplus */
64 #endif /* dissector_filters.h */