2 * $Id: dfilter.h,v 1.4 2002/01/21 07:37:37 guy Exp $
4 * Ethereal - Network traffic analyzer
5 * By Gerald Combs <gerald@ethereal.com>
6 * Copyright 2001 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 /* Passed back to user */
29 typedef struct _dfilter_t dfilter_t;
31 #include <epan/epan.h>
32 #include <epan/proto.h>
35 /* Module-level initialization */
39 /* Module-level cleanup */
41 dfilter_cleanup(void);
43 /* Compiles a string to a dfilter_t.
44 * On success, sets the dfilter* pointed to by dfp
45 * to either a NULL pointer (if the filter is a null
46 * filter, as generated by an all-blank string) or to
47 * a pointer to the newly-allocated dfilter_t
50 * On failure, dfilter_error_msg points to an
51 * appropriate error message. This error message is
52 * a global string, so another invocation of
53 * dfilter_compile() will clear it. The dfilter*
54 * will be set to NULL after a failure.
56 * Returns TRUE on success, FALSE on failure.
59 dfilter_compile(gchar *text, dfilter_t **dfp);
61 /* Frees all memory used by dfilter, and frees
62 * the dfilter itself. */
64 dfilter_free(dfilter_t *df);
67 /* dfilter_error_msg is NULL if there was no error during dfilter_compile,
68 * otherwise it points to a displayable error message. */
69 extern gchar *dfilter_error_msg;
71 /* Apply compiled dfilter */
73 dfilter_apply_edt(dfilter_t *df, epan_dissect_t* edt);
75 /* Apply compiled dfilter */
77 dfilter_apply(dfilter_t *df, tvbuff_t *tvb, proto_tree *tree);
79 /* Run a callback for each interesting field in the dfilter. */
81 dfilter_foreach_interesting_field(dfilter_t *df, GFunc func,
84 /* Print bytecode of dfilter to stdout */
86 dfilter_dump(dfilter_t *df);