diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-03-23 21:19:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-03-23 21:19:58 +0000 |
commit | 121f06fab70d77c4babb512924b2b8d3c3921944 (patch) | |
tree | 9dba3131d845040ea0ab402a8b3e4a5147d5d315 /epan/epan.c | |
parent | bf1315c25615bdd7d5ebff4245d8ba37b525871e (diff) | |
download | wireshark-121f06fab70d77c4babb512924b2b8d3c3921944.tar.gz wireshark-121f06fab70d77c4babb512924b2b8d3c3921944.tar.bz2 wireshark-121f06fab70d77c4babb512924b2b8d3c3921944.zip |
Make "epan_init()" take, as additional arguments, pointers to routines
that dissectors should call to report file open and read errors, and
have "report_open_failure()" and "report_read_failure()" call through
those pointers, rather than being defined and exported by the
application using libethereal - instead, the application would define
those functions and pass pointers to them to 'epan_init()".
Move "report_err.h" to the epan directory, as the functions it declares
are now part of the libethereal API.
svn path=/trunk/; revision=10470
Diffstat (limited to 'epan/epan.c')
-rw-r--r-- | epan/epan.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/epan/epan.c b/epan/epan.c index 27fcb91177..b1fc6adc91 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -1,6 +1,6 @@ /* epan.h * - * $Id: epan.c,v 1.23 2003/05/04 18:50:53 gerald Exp $ + * $Id: epan.c,v 1.24 2004/03/23 21:19:56 guy Exp $ * * Ethereal Protocol Analyzer Library */ @@ -12,6 +12,7 @@ #include <glib.h> #include "epan.h" #include "epan_dissect.h" +#include "report_err.h" #include "conversation.h" #include "circuit.h" @@ -21,6 +22,9 @@ #include "../tap.h" #include "resolv.h" +static void (*report_open_failure_func)(const char *, int, gboolean); +static void (*report_read_failure_func)(const char *, int); + /* * XXX - this takes the plugin directory as an argument, because * libethereal now has its own configure script and "config.h" file, @@ -43,9 +47,13 @@ * libraries are located.) */ void -epan_init(const char *plugin_dir, void (register_all_protocols)(void), - void (register_all_handoffs)(void)) +epan_init(const char *plugin_dir, void (*register_all_protocols)(void), + void (*register_all_handoffs)(void), + void (*report_open_failure)(const char *, int, gboolean), + void (*report_read_failure)(const char *, int)) { + report_open_failure_func = report_open_failure; + report_read_failure_func = report_read_failure; except_init(); tvbuff_init(); frame_data_init(); @@ -81,6 +89,25 @@ epan_circuit_init(void) circuit_init(); } +/* + * Report an error when trying to open a file. + */ +void +report_open_failure(const char *filename, int err, + gboolean for_writing) +{ + (*report_open_failure_func)(filename, err, for_writing); +} + +/* + * Report an error when trying to read a file. + */ +void +report_read_failure(const char *filename, int err) +{ + (*report_read_failure_func)(filename, err); +} + epan_dissect_t* epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible) { |