Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
dfilter.h
1 /*
2  * Wireshark - Network traffic analyzer
3  * By Gerald Combs <gerald@wireshark.org>
4  * Copyright 2001 Gerald Combs
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef DFILTER_H
10 #define DFILTER_H
11 
12 #include <glib.h>
13 #include "ws_symbol_export.h"
14 
15 /* Passed back to user */
16 typedef struct epan_dfilter dfilter_t;
17 
18 #include <epan/proto.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
24 struct epan_dissect;
25 
26 /* Module-level initialization */
27 void
28 dfilter_init(void);
29 
30 /* Module-level cleanup */
31 void
32 dfilter_cleanup(void);
33 
34 /* Compiles a string to a dfilter_t.
35  * On success, sets the dfilter* pointed to by dfp
36  * to either a NULL pointer (if the filter is a null
37  * filter, as generated by an all-blank string) or to
38  * a pointer to the newly-allocated dfilter_t
39  * structure.
40  *
41  * On failure, *err_msg is set to point to the error
42  * message. This error message is allocated with
43  * g_malloc(), and must be freed with g_free().
44  * The dfilter* will be set to NULL after a failure.
45  *
46  * Returns TRUE on success, FALSE on failure.
47  */
48 WS_DLL_PUBLIC
49 gboolean
50 dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg);
51 
52 /* Frees all memory used by dfilter, and frees
53  * the dfilter itself. */
54 WS_DLL_PUBLIC
55 void
56 dfilter_free(dfilter_t *df);
57 
58 /* Apply compiled dfilter */
59 WS_DLL_PUBLIC
60 gboolean
61 dfilter_apply_edt(dfilter_t *df, struct epan_dissect *edt);
62 
63 /* Apply compiled dfilter */
64 gboolean
65 dfilter_apply(dfilter_t *df, proto_tree *tree);
66 
67 /* Prime a proto_tree using the fields/protocols used in a dfilter. */
68 void
69 dfilter_prime_proto_tree(const dfilter_t *df, proto_tree *tree);
70 
71 /* Check if dfilter has interesting fields */
72 gboolean
73 dfilter_has_interesting_fields(const dfilter_t *df);
74 
75 WS_DLL_PUBLIC
76 GPtrArray *
77 dfilter_deprecated_tokens(dfilter_t *df);
78 
79 /* Print bytecode of dfilter to stdout */
80 WS_DLL_PUBLIC
81 void
82 dfilter_dump(dfilter_t *df);
83 
84 #ifdef __cplusplus
85 }
86 #endif /* __cplusplus */
87 
88 #endif /* DFILTER_H */
Definition: dfilter-int.h:19
Definition: epan_dissect.h:28
Definition: proto.h:759