Get rid of the check for NetBSD in the Wiretap "configure.in"; we
[obnox/wireshark/wip.git] / dfilter.h
1 /* dfilter.h
2  * Definitions for display filters
3  *
4  * $Id: dfilter.h,v 1.15 2000/01/15 00:22:30 gram Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __DFILTER_H__
27 #define __DFILTER_H__
28
29 #ifndef __PROTO_H__
30 #include "proto.h"
31 #endif
32
33 /* dfilter_error_msg is NULL if there was no error during dfilter_compile,
34  * otherwise it points to a displayable error message. */
35 extern gchar *dfilter_error_msg;
36 extern gchar dfilter_error_msg_buf[1024];
37
38 typedef struct {
39
40         GNode *dftree;
41
42         /* space for dfilter_nodes */
43         GMemChunk *node_memchunk;
44
45         /* list of byte arrays we allocate during parse. We can traverse this list
46          * faster than the tree when we go back and free the byte arrays */
47         GSList *list_of_byte_arrays;
48 } dfilter;
49
50 /* Initialization of the symbol table. Called once during program startup */
51 void dfilter_init(void);
52
53 /* Free the memory used by the symbol table. Called at program shutdown */
54 void dfilter_cleanup(void);
55
56 /* Allocate and initialize new dfilter struct. Returns pointer to new dfilter */
57 dfilter* dfilter_new(void);
58
59 /* Frees all memory used by dfilter, and frees dfilter itself */
60 void dfilter_destroy(dfilter *df);
61
62 /* Compile display filter text */
63 int dfilter_compile(gchar* dfilter_text, dfilter** dfp);
64
65 /* Apply compiled dfilter to a proto_tree */
66 gboolean dfilter_apply(dfilter *df, proto_tree *ptree, const guint8* pd);
67
68 #endif /* ! __DFILTER_H__ */