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_INT_H
|
|
|
|
#define DFILTER_INT_H
|
|
|
|
|
|
|
|
#include "dfilter.h"
|
|
|
|
#include "syntax-tree.h"
|
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/proto.h>
|
2004-06-15 10:38:14 +00:00
|
|
|
#include <stdio.h>
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* Passed back to user */
|
2013-12-03 20:59:25 +00:00
|
|
|
struct epan_dfilter {
|
2001-02-01 20:21:25 +00:00
|
|
|
GPtrArray *insns;
|
2007-11-28 22:44:37 +00:00
|
|
|
GPtrArray *consts;
|
2009-10-18 23:25:33 +00:00
|
|
|
guint num_registers;
|
|
|
|
guint max_registers;
|
2001-02-01 20:21:25 +00:00
|
|
|
GList **registers;
|
|
|
|
gboolean *attempted_load;
|
2004-02-11 22:52:54 +00:00
|
|
|
int *interesting_fields;
|
|
|
|
int num_interesting_fields;
|
2008-01-31 19:50:38 +00:00
|
|
|
GPtrArray *deprecated;
|
2001-02-01 20:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* Syntax Tree stuff */
|
|
|
|
stnode_t *st_root;
|
|
|
|
gboolean syntax_error;
|
2015-01-18 10:22:19 +00:00
|
|
|
gchar *error_message;
|
2001-02-01 20:21:25 +00:00
|
|
|
GPtrArray *insns;
|
2007-11-28 22:44:37 +00:00
|
|
|
GPtrArray *consts;
|
2001-02-01 20:21:25 +00:00
|
|
|
GHashTable *loaded_fields;
|
2001-12-18 19:09:08 +00:00
|
|
|
GHashTable *interesting_fields;
|
2001-02-01 20:21:25 +00:00
|
|
|
int next_insn_id;
|
2007-11-28 22:44:37 +00:00
|
|
|
int next_const_id;
|
2001-02-01 20:21:25 +00:00
|
|
|
int next_register;
|
2007-11-28 22:44:37 +00:00
|
|
|
int first_constant; /* first register used as a constant */
|
2001-02-01 20:21:25 +00:00
|
|
|
} dfwork_t;
|
|
|
|
|
2015-01-18 10:22:19 +00:00
|
|
|
/*
|
2016-03-31 01:44:01 +00:00
|
|
|
* State kept by the scanner.
|
2015-01-18 10:22:19 +00:00
|
|
|
*/
|
2016-03-31 01:44:01 +00:00
|
|
|
typedef struct {
|
|
|
|
dfwork_t *dfw;
|
|
|
|
GString* quoted_string;
|
2018-04-17 15:49:17 +00:00
|
|
|
gboolean in_set; /* true if parsing set elements for the membership operator */
|
2016-03-31 01:44:01 +00:00
|
|
|
} df_scanner_state_t;
|
2015-01-18 10:22:19 +00:00
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
/* Constructor/Destructor prototypes for Lemon Parser */
|
2008-03-21 16:10:47 +00:00
|
|
|
void *DfilterAlloc(void* (*)(gsize));
|
|
|
|
|
2001-02-15 06:22:46 +00:00
|
|
|
void DfilterFree(void*, void (*)(void *));
|
2001-02-01 20:21:25 +00:00
|
|
|
void Dfilter(void*, int, stnode_t*, dfwork_t*);
|
|
|
|
|
|
|
|
/* Scanner's lval */
|
|
|
|
extern stnode_t *df_lval;
|
|
|
|
|
2004-02-11 22:52:54 +00:00
|
|
|
/* Return value for error in scanner. */
|
|
|
|
#define SCAN_FAILED -1 /* not 0, as that means end-of-input */
|
|
|
|
|
2015-01-18 10:22:19 +00:00
|
|
|
/* Set dfw->error_message */
|
2001-02-01 20:21:25 +00:00
|
|
|
void
|
2015-01-18 10:22:19 +00:00
|
|
|
dfilter_fail(dfwork_t *dfw, const char *format, ...) G_GNUC_PRINTF(2, 3);
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2004-06-15 10:38:14 +00:00
|
|
|
void
|
|
|
|
DfilterTrace(FILE *TraceFILE, char *zTracePrompt);
|
|
|
|
|
2001-02-01 20:21:25 +00:00
|
|
|
#endif
|