2001-02-01 20:31:21 +00:00
|
|
|
/*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-02-01 20:31:21 +00:00
|
|
|
* Copyright 2001 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2001-02-01 20:21:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DFILTER_H
|
|
|
|
#define DFILTER_H
|
|
|
|
|
|
|
|
#include <glib.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* Passed back to user */
|
2013-12-03 20:59:25 +00:00
|
|
|
typedef struct epan_dfilter dfilter_t;
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/proto.h>
|
2001-12-18 19:09:08 +00:00
|
|
|
|
2012-01-04 21:26:51 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
2001-12-18 19:09:08 +00:00
|
|
|
|
2013-12-03 23:49:51 +00:00
|
|
|
struct epan_dissect;
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
/* Module-level initialization */
|
|
|
|
void
|
|
|
|
dfilter_init(void);
|
|
|
|
|
|
|
|
/* Module-level cleanup */
|
|
|
|
void
|
|
|
|
dfilter_cleanup(void);
|
|
|
|
|
|
|
|
/* Compiles a string to a dfilter_t.
|
|
|
|
* On success, sets the dfilter* pointed to by dfp
|
|
|
|
* to either a NULL pointer (if the filter is a null
|
|
|
|
* filter, as generated by an all-blank string) or to
|
|
|
|
* a pointer to the newly-allocated dfilter_t
|
|
|
|
* structure.
|
|
|
|
*
|
2015-01-18 10:22:19 +00:00
|
|
|
* On failure, *err_msg is set to point to the error
|
|
|
|
* message. This error message is allocated with
|
|
|
|
* g_malloc(), and must be freed with g_free().
|
|
|
|
* The dfilter* will be set to NULL after a failure.
|
2001-02-01 20:21:25 +00:00
|
|
|
*
|
|
|
|
* Returns TRUE on success, FALSE on failure.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-02-01 20:21:25 +00:00
|
|
|
gboolean
|
2015-01-18 10:22:19 +00:00
|
|
|
dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* Frees all memory used by dfilter, and frees
|
|
|
|
* the dfilter itself. */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-02-01 20:21:25 +00:00
|
|
|
void
|
|
|
|
dfilter_free(dfilter_t *df);
|
|
|
|
|
|
|
|
/* Apply compiled dfilter */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-02-01 20:21:25 +00:00
|
|
|
gboolean
|
2013-12-03 23:49:51 +00:00
|
|
|
dfilter_apply_edt(dfilter_t *df, struct epan_dissect *edt);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* Apply compiled dfilter */
|
|
|
|
gboolean
|
2002-05-09 23:50:34 +00:00
|
|
|
dfilter_apply(dfilter_t *df, proto_tree *tree);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2002-05-09 23:50:34 +00:00
|
|
|
/* Prime a proto_tree using the fields/protocols used in a dfilter. */
|
2001-12-18 19:09:08 +00:00
|
|
|
void
|
2002-09-09 21:04:15 +00:00
|
|
|
dfilter_prime_proto_tree(const dfilter_t *df, proto_tree *tree);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2016-02-03 22:10:40 +00:00
|
|
|
/* Check if dfilter has interesting fields */
|
|
|
|
gboolean
|
|
|
|
dfilter_has_interesting_fields(const dfilter_t *df);
|
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2008-01-31 19:50:38 +00:00
|
|
|
GPtrArray *
|
|
|
|
dfilter_deprecated_tokens(dfilter_t *df);
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
/* Print bytecode of dfilter to stdout */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-02-01 20:21:25 +00:00
|
|
|
void
|
|
|
|
dfilter_dump(dfilter_t *df);
|
|
|
|
|
2012-01-04 21:26:51 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* DFILTER_H */
|