Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
/* epan.h
|
|
|
|
*
|
Clean up the dissector registration up a bit - arrange that all plugins
be loaded and their initialization routines called in right after we
call the initialization routines for built-in dissectors, but don't call
their handoff registration routines yet, and then call the handoff
registration routines right after calling the handoff registration
routines for built-in dissectors.
Do all that in "proto_init()", rather than "epan_init()".
That way, we call all dissector registration routines together, and then
call all dissector handoff registration routines together; all the
registration routines are called before any handoff registration
routines, as is required, and, as "proto_init()" is called by
"epan_init()" before "dfilter_init()" is called, all filterable fields
have been registered before "dfilter_init()" is called, and no plugins
have to call "dfilter_init()" themselves to get their fields registered.
Remove pointers to "dfilter_init()" and "dfilter_cleanup()" from the
plugin address table, as plugins shouldn't be calling them any more, and
remove calls to them from plugins.
svn path=/trunk/; revision=2940
2001-01-26 06:14:53 +00:00
|
|
|
* $Id: epan.c,v 1.5 2001/01/26 06:14:50 guy Exp $
|
Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
*
|
|
|
|
* Ethereal Protocol Analyzer Library
|
|
|
|
*
|
|
|
|
*/
|
2000-09-27 04:55:05 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan.h>
|
|
|
|
|
|
|
|
#include "conversation.h"
|
|
|
|
#include "dfilter.h"
|
|
|
|
#include "except.h"
|
2000-10-06 10:11:40 +00:00
|
|
|
#include "packet.h"
|
2000-09-27 04:55:05 +00:00
|
|
|
#include "proto.h"
|
|
|
|
#include "tvbuff.h"
|
|
|
|
|
Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
/*
|
|
|
|
* XXX - this takes the plugin directory as an argument, because
|
|
|
|
* libethereal now has its own configure script and "config.h" file,
|
|
|
|
* which is what code in the "epan" directory includes, but we need
|
|
|
|
* to define PLUGIN_DIR in the top-level directory, as it's used by,
|
|
|
|
* for example, the Makefile for the Gryphon plugin, so it knows
|
|
|
|
* where to install the plugin.
|
|
|
|
*
|
|
|
|
* Eventually, we should probably have an "epan-configure" script
|
|
|
|
* (or "libethereal-configure", or whatever), along the lines of what
|
|
|
|
* GTK+ and GLib have, that can print, among other things, the directory
|
|
|
|
* into which plugins should be installed. That way, only libethereal
|
|
|
|
* need know what directory that is; programs using it won't, *and*
|
|
|
|
* Makefiles for plugins can just use "epan-configure" to figure out
|
|
|
|
* where to install the plugins.
|
|
|
|
*
|
|
|
|
* (Would that *more* libraries had configure scripts like that, so
|
|
|
|
* that configure scripts didn't have to go through various contortions
|
|
|
|
* to figure out where the header files and libraries for various
|
|
|
|
* libraries are located.)
|
|
|
|
*/
|
2000-09-27 04:55:05 +00:00
|
|
|
void
|
Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
epan_init(const char *plugin_dir)
|
2000-09-27 04:55:05 +00:00
|
|
|
{
|
|
|
|
except_init();
|
|
|
|
tvbuff_init();
|
2000-10-06 10:11:40 +00:00
|
|
|
packet_init();
|
Clean up the dissector registration up a bit - arrange that all plugins
be loaded and their initialization routines called in right after we
call the initialization routines for built-in dissectors, but don't call
their handoff registration routines yet, and then call the handoff
registration routines right after calling the handoff registration
routines for built-in dissectors.
Do all that in "proto_init()", rather than "epan_init()".
That way, we call all dissector registration routines together, and then
call all dissector handoff registration routines together; all the
registration routines are called before any handoff registration
routines, as is required, and, as "proto_init()" is called by
"epan_init()" before "dfilter_init()" is called, all filterable fields
have been registered before "dfilter_init()" is called, and no plugins
have to call "dfilter_init()" themselves to get their fields registered.
Remove pointers to "dfilter_init()" and "dfilter_cleanup()" from the
plugin address table, as plugins shouldn't be calling them any more, and
remove calls to them from plugins.
svn path=/trunk/; revision=2940
2001-01-26 06:14:53 +00:00
|
|
|
proto_init(plugin_dir);
|
2000-09-27 04:55:05 +00:00
|
|
|
dfilter_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
epan_cleanup(void)
|
|
|
|
{
|
|
|
|
dfilter_cleanup();
|
|
|
|
proto_cleanup();
|
2000-10-06 10:11:40 +00:00
|
|
|
packet_cleanup();
|
2000-09-27 04:55:05 +00:00
|
|
|
tvbuff_cleanup();
|
|
|
|
except_deinit();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
epan_conversation_init(void)
|
|
|
|
{
|
|
|
|
conversation_init();
|
|
|
|
}
|
2000-10-06 10:11:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct epan_dissect {
|
|
|
|
|
|
|
|
tvbuff_t *tvb;
|
|
|
|
proto_tree *tree;
|
|
|
|
};
|
|
|
|
|
|
|
|
epan_dissect_t*
|
|
|
|
epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_tree *tree)
|
|
|
|
{
|
|
|
|
epan_dissect_t *edt;
|
|
|
|
|
|
|
|
edt = g_new(epan_dissect_t, 1);
|
|
|
|
|
|
|
|
/* XXX - init tree */
|
|
|
|
dissect_packet(&edt->tvb, pseudo_header, data, fd, tree);
|
|
|
|
|
|
|
|
return edt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
epan_dissect_free(epan_dissect_t* edt)
|
|
|
|
{
|
|
|
|
/* Free all tvb's created from this tvb, unless dissector
|
|
|
|
* wanted to store the pointer (in which case, the dissector
|
|
|
|
* would have incremented the usage count on that tvbuff_t*) */
|
|
|
|
tvb_free_chain(edt->tvb);
|
|
|
|
|
|
|
|
g_free(edt);
|
|
|
|
}
|