From Didier:
optimization for COLUMNS to make ethereal faster when filtering optimization to make the slow find_protocol_by_id() fast. (idea from Didier, implementation modified by me to be less intrusive) svn path=/trunk/; revision=14026
This commit is contained in:
parent
412e592a12
commit
df98534657
27
epan/proto.c
27
epan/proto.c
|
@ -2442,7 +2442,7 @@ proto_register_protocol(char *name, char *short_name, char *filter_name)
|
|||
hfinfo->name = name;
|
||||
hfinfo->abbrev = filter_name;
|
||||
hfinfo->type = FT_PROTOCOL;
|
||||
hfinfo->strings = NULL;
|
||||
hfinfo->strings = protocol;
|
||||
hfinfo->bitmask = 0;
|
||||
hfinfo->bitshift = 0;
|
||||
hfinfo->blurb = "";
|
||||
|
@ -2515,27 +2515,17 @@ proto_get_next_protocol_field(void **cookie)
|
|||
return &ptr->hfinfo;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the protocol list entry for a protocol given its field ID.
|
||||
*/
|
||||
static gint
|
||||
compare_proto_id(gconstpointer proto_arg, gconstpointer id_arg)
|
||||
{
|
||||
const protocol_t *protocol = proto_arg;
|
||||
const int *id_ptr = id_arg;
|
||||
|
||||
return (protocol->proto_id == *id_ptr) ? 0 : 1;
|
||||
}
|
||||
|
||||
protocol_t *
|
||||
find_protocol_by_id(int proto_id)
|
||||
{
|
||||
GList *list_entry;
|
||||
header_field_info *hfinfo;
|
||||
|
||||
list_entry = g_list_find_custom(protocols, &proto_id, compare_proto_id);
|
||||
if (list_entry == NULL)
|
||||
if(proto_id<0)
|
||||
return NULL;
|
||||
return list_entry->data;
|
||||
|
||||
PROTO_REGISTRAR_GET_NTH(proto_id, hfinfo);
|
||||
DISSECTOR_ASSERT(hfinfo->type==FT_PROTOCOL);
|
||||
return (protocol_t *)hfinfo->strings;
|
||||
}
|
||||
|
||||
static gint compare_filter_name(gconstpointer proto_arg,
|
||||
|
@ -2668,7 +2658,7 @@ proto_register_field_init(header_field_info *hfinfo, int parent)
|
|||
DISSECTOR_ASSERT(hfinfo->name);
|
||||
DISSECTOR_ASSERT(hfinfo->abbrev);
|
||||
|
||||
/* These types of fields are allowed to have value_strings or true_false_strings */
|
||||
/* These types of fields are allowed to have value_strings, true_false_strings or a protocol_t struct*/
|
||||
DISSECTOR_ASSERT((hfinfo->strings == NULL) || (
|
||||
(hfinfo->type == FT_UINT8) ||
|
||||
(hfinfo->type == FT_UINT16) ||
|
||||
|
@ -2679,6 +2669,7 @@ proto_register_field_init(header_field_info *hfinfo, int parent)
|
|||
(hfinfo->type == FT_INT24) ||
|
||||
(hfinfo->type == FT_INT32) ||
|
||||
(hfinfo->type == FT_BOOLEAN) ||
|
||||
(hfinfo->type == FT_PROTOCOL) ||
|
||||
(hfinfo->type == FT_FRAMENUM) ));
|
||||
|
||||
switch (hfinfo->type) {
|
||||
|
|
|
@ -147,7 +147,7 @@ struct _header_field_info {
|
|||
char *abbrev; /**< abbreviated name of this field */
|
||||
enum ftenum type; /**< field type, one of FT_ (from ftypes.h) */
|
||||
int display; /**< one of BASE_, or number of field bits for FT_BOOLEAN */
|
||||
const void *strings; /**< _value_string (or true_false_string for FT_BOOLEAN), typically converted by VALS() or TFS() */
|
||||
const void *strings; /**< _value_string (or true_false_string for FT_BOOLEAN), typically converted by VALS() or TFS() If this is an FT_PROTOCOL then it points to the associated protocol_t structure*/
|
||||
guint32 bitmask; /**< FT_BOOLEAN only: bitmask of interesting bits */
|
||||
char *blurb; /**< Brief description of field. */
|
||||
|
||||
|
|
|
@ -3549,7 +3549,7 @@ void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
}
|
||||
edt = epan_dissect_new(TRUE, FALSE);
|
||||
epan_dissect_prime_dfilter(edt, sfcode);
|
||||
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, &cf->cinfo);
|
||||
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, NULL);
|
||||
frame_matched = dfilter_apply_edt(sfcode, edt);
|
||||
|
||||
/* if it is not an rtp frame, show the rtpstream dialog */
|
||||
|
|
|
@ -742,7 +742,7 @@ void sctp_analyse_cb(struct sctp_analyse* u_data)
|
|||
|
||||
edt = epan_dissect_new(TRUE, FALSE);
|
||||
epan_dissect_prime_dfilter(edt, sfcode);
|
||||
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, &cf->cinfo);
|
||||
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, NULL);
|
||||
frame_matched = dfilter_apply_edt(sfcode, edt);
|
||||
|
||||
/* if it is not an sctp frame, show the dialog */
|
||||
|
|
|
@ -145,7 +145,7 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
|
|||
return FALSE; /* failure */
|
||||
}
|
||||
|
||||
/* Dissect the frame */
|
||||
/* Dissect the frame tree not visible */
|
||||
edt = epan_dissect_new(TRUE, FALSE);
|
||||
epan_dissect_run(edt, &phdr, pd, frame, cinfo);
|
||||
|
||||
|
@ -253,8 +253,9 @@ ph_stats_new(void)
|
|||
ps->first_time = cur_time;
|
||||
ps->last_time = cur_time;
|
||||
}
|
||||
|
||||
if (!process_frame(frame, &cfile.cinfo, ps)) {
|
||||
|
||||
/* we don't care about colinfo */
|
||||
if (!process_frame(frame, NULL, ps)) {
|
||||
/*
|
||||
* Give up, and set "stop_flag" so we
|
||||
* just abort rather than popping up
|
||||
|
|
Loading…
Reference in New Issue