Changed packet_init() to look up the frame dissector and cache its

dissector_handle in a static variable in packet.c.  Changed dissect_packet
to call dissector from using the call_dissector() function and the cached
dissector_handle for frame_dissector.  Changed the order of function
calls in epan_init() to allow for this change ( it sucks to look up
a dissector when none are registered ).

svn path=/trunk/; revision=3234
This commit is contained in:
Ed Warnicke 2001-04-01 22:01:34 +00:00
parent 62e9875d34
commit 10cd0c5f70
2 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,6 @@
/* epan.h
*
* $Id: epan.c,v 1.8 2001/04/01 04:11:50 hagbard Exp $
* $Id: epan.c,v 1.9 2001/04/01 22:01:34 hagbard Exp $
*
* Ethereal Protocol Analyzer Library
*
@ -46,9 +46,9 @@ epan_init(const char *plugin_dir)
{
except_init();
tvbuff_init();
packet_init();
frame_data_init();
proto_init(plugin_dir);
packet_init();
dfilter_init();
}

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.31 2001/04/01 07:32:35 hagbard Exp $
* $Id: packet.c,v 1.32 2001/04/01 22:01:34 hagbard Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -82,10 +82,12 @@
#include "tvbuff.h"
#include "plugins.h"
static dissector_handle_t frame_handle = NULL;
void
packet_init(void)
{
/* nothing */
frame_handle = find_dissector("frame");
}
void
@ -155,7 +157,8 @@ dissect_packet(tvbuff_t **p_tvb, union wtap_pseudo_header *pseudo_header,
}
ENDTRY;
dissect_frame(*p_tvb, &pi, tree);
if(frame_handle != NULL)
call_dissector(frame_handle, *p_tvb, &pi, tree);
fd->flags.visited = 1;
}