Change dfilter_apply() to 4-argument function. 4th argument is not yet used,
but will be in the future, and it's easier for me to keep my local branch in sync with the source with the calls to dfilter_apply() already modified tothe 4-arg format. Add a CPP macro to ipv4.h to define ipv4_addr_ne(). Use it in dfilter.c svn path=/trunk/; revision=1854
This commit is contained in:
parent
d716875317
commit
61167a3c28
|
@ -1,7 +1,7 @@
|
|||
/* dfilter.c
|
||||
* Routines for display filters
|
||||
*
|
||||
* $Id: dfilter.c,v 1.33 2000/03/20 22:52:41 gram Exp $
|
||||
* $Id: dfilter.c,v 1.34 2000/04/14 05:39:36 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -314,7 +314,7 @@ g_strcmp(gconstpointer a, gconstpointer b)
|
|||
|
||||
|
||||
gboolean
|
||||
dfilter_apply(dfilter *dfcode, proto_tree *ptree, const guint8* pd)
|
||||
dfilter_apply(dfilter *dfcode, proto_tree *ptree, const guint8* pd, guint pd_len)
|
||||
{
|
||||
gboolean retval;
|
||||
if (dfcode == NULL)
|
||||
|
@ -828,7 +828,7 @@ gboolean check_relation_ipv4(gint operand, GArray *a, GArray *b)
|
|||
ptr_a = (ipv4_addr*) g_array_index_ptr(a, sizeof(ipv4_addr), i);
|
||||
for (j = 0; j < len_b; j++) {
|
||||
ptr_b = (ipv4_addr*) g_array_index_ptr(b, sizeof(ipv4_addr), j);
|
||||
if (!ipv4_addr_eq(ptr_a, ptr_b))
|
||||
if (ipv4_addr_ne(ptr_a, ptr_b))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* dfilter.h
|
||||
* Definitions for display filters
|
||||
*
|
||||
* $Id: dfilter.h,v 1.15 2000/01/15 00:22:30 gram Exp $
|
||||
* $Id: dfilter.h,v 1.16 2000/04/14 05:39:38 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -63,6 +63,6 @@ void dfilter_destroy(dfilter *df);
|
|||
int dfilter_compile(gchar* dfilter_text, dfilter** dfp);
|
||||
|
||||
/* Apply compiled dfilter to a proto_tree */
|
||||
gboolean dfilter_apply(dfilter *df, proto_tree *ptree, const guint8* pd);
|
||||
gboolean dfilter_apply(dfilter *df, proto_tree *ptree, const guint8* pd, guint pd_len);
|
||||
|
||||
#endif /* ! __DFILTER_H__ */
|
||||
|
|
12
file.c
12
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.182 2000/04/13 20:39:12 gram Exp $
|
||||
* $Id: file.c,v 1.183 2000/04/14 05:39:39 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -487,6 +487,7 @@ typedef struct {
|
|||
color_filter_t *colorf;
|
||||
proto_tree *protocol_tree;
|
||||
const guint8 *pd;
|
||||
frame_data *fdata;
|
||||
} apply_color_filter_args;
|
||||
|
||||
/*
|
||||
|
@ -501,7 +502,7 @@ apply_color_filter(gpointer filter_arg, gpointer argp)
|
|||
apply_color_filter_args *args = argp;
|
||||
|
||||
if (colorf->c_colorfilter != NULL && args->colorf == NULL) {
|
||||
if (dfilter_apply(colorf->c_colorfilter, args->protocol_tree, args->pd))
|
||||
if (dfilter_apply(colorf->c_colorfilter, args->protocol_tree, args->pd, args->fdata->cap_len))
|
||||
args->colorf = colorf;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +544,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf
|
|||
protocol_tree = proto_tree_create_root();
|
||||
dissect_packet(buf, fdata, protocol_tree);
|
||||
if (cf->dfcode != NULL)
|
||||
fdata->flags.passed_dfilter = dfilter_apply(cf->dfcode, protocol_tree, buf) ? 1 : 0;
|
||||
fdata->flags.passed_dfilter = dfilter_apply(cf->dfcode, protocol_tree, buf, fdata->cap_len) ? 1 : 0;
|
||||
else
|
||||
fdata->flags.passed_dfilter = 1;
|
||||
|
||||
|
@ -551,6 +552,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf
|
|||
if (filter_list != NULL) {
|
||||
args.protocol_tree = protocol_tree;
|
||||
args.pd = buf;
|
||||
args.fdata = fdata;
|
||||
g_slist_foreach(filter_list, apply_color_filter, &args);
|
||||
}
|
||||
proto_tree_free(protocol_tree);
|
||||
|
@ -688,7 +690,7 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
|||
if (cf->rfcode) {
|
||||
protocol_tree = proto_tree_create_root();
|
||||
dissect_packet(buf, fdata, protocol_tree);
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf);
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf, fdata->cap_len);
|
||||
proto_tree_free(protocol_tree);
|
||||
}
|
||||
if (passed) {
|
||||
|
@ -1203,7 +1205,7 @@ find_packet(capture_file *cf, dfilter *sfcode)
|
|||
protocol_tree = proto_tree_create_root();
|
||||
wtap_seek_read(cf->cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len);
|
||||
dissect_packet(cf->pd, fd, protocol_tree);
|
||||
frame_matched = dfilter_apply(sfcode, protocol_tree, cf->pd);
|
||||
frame_matched = dfilter_apply(sfcode, protocol_tree, cf->pd, fd->cap_len);
|
||||
proto_tree_free(protocol_tree);
|
||||
if (frame_matched) {
|
||||
new_fd = fd;
|
||||
|
|
4
ipv4.h
4
ipv4.h
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
* $Id: ipv4.h,v 1.5 2000/04/12 20:24:34 gram Exp $
|
||||
* $Id: ipv4.h,v 1.6 2000/04/14 05:39:41 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -61,4 +61,6 @@ gboolean ipv4_addr_ge(ipv4_addr *a, ipv4_addr *b);
|
|||
gboolean ipv4_addr_lt(ipv4_addr *a, ipv4_addr *b);
|
||||
gboolean ipv4_addr_le(ipv4_addr *a, ipv4_addr *b);
|
||||
|
||||
#define ipv4_addr_ne(a,b) !ipv4_addr_eq((a),(b))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-tcp.c
|
||||
* Routines for TCP packet disassembly
|
||||
*
|
||||
* $Id: packet-tcp.c,v 1.68 2000/04/13 18:18:49 gram Exp $
|
||||
* $Id: packet-tcp.c,v 1.69 2000/04/14 05:39:42 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -386,7 +386,7 @@ decode_tcp_ports( const u_char *pd, int offset, frame_data *fd, proto_tree *tree
|
|||
if (enabled_plugins_number > 0) {
|
||||
while (pt_plug) {
|
||||
if (pt_plug->enabled && !strcmp(pt_plug->protocol, "tcp") &&
|
||||
tree && dfilter_apply(pt_plug->filter, tree, pd)) {
|
||||
tree && dfilter_apply(pt_plug->filter, tree, pd, fd->cap_len)) {
|
||||
pt_plug->dissector(pd, offset, fd, tree);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-udp.c
|
||||
* Routines for UDP packet disassembly
|
||||
*
|
||||
* $Id: packet-udp.c,v 1.61 2000/04/13 18:18:50 gram Exp $
|
||||
* $Id: packet-udp.c,v 1.62 2000/04/14 05:39:43 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -119,7 +119,7 @@ decode_udp_ports( const u_char *pd, int offset, frame_data *fd,
|
|||
if (enabled_plugins_number > 0) {
|
||||
while (pt_plug) {
|
||||
if (pt_plug->enabled && !strcmp(pt_plug->protocol, "udp") &&
|
||||
tree && dfilter_apply(pt_plug->filter, tree, pd)) {
|
||||
tree && dfilter_apply(pt_plug->filter, tree, pd, fd->cap_len)) {
|
||||
pt_plug->dissector(pd, offset, fd, tree);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* tethereal.c
|
||||
*
|
||||
* $Id: tethereal.c,v 1.25 2000/04/13 20:39:19 gram Exp $
|
||||
* $Id: tethereal.c,v 1.26 2000/04/14 05:39:43 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -831,7 +831,7 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
|||
fill_in_fdata(&fdata, cf, phdr, offset);
|
||||
protocol_tree = proto_tree_create_root();
|
||||
dissect_packet(buf, &fdata, protocol_tree);
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf);
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf, fdata.cap_len);
|
||||
} else {
|
||||
protocol_tree = NULL;
|
||||
passed = TRUE;
|
||||
|
@ -866,7 +866,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
|||
protocol_tree = NULL;
|
||||
dissect_packet(buf, &fdata, protocol_tree);
|
||||
if (cf->rfcode)
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf);
|
||||
passed = dfilter_apply(cf->rfcode, protocol_tree, buf, fdata.cap_len);
|
||||
if (passed) {
|
||||
/* The packet passed the read filter. */
|
||||
if (verbose) {
|
||||
|
|
Loading…
Reference in New Issue