Ethereal-dev: [Ethereal-dev] patch to allow exceptions in plugins on win32

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Matthijs Melchior <mmelchior@xxxxxxxxx>
Date: Wed, 30 Apr 2003 17:20:03 +0200
Hi,
   here is a patch to add the public interface for exception handling
to the win32 plugin address table. I do not have my win32 build
environment available today and therefore this patch is not tested..,
but I am eager to have it included in the imminent release....!

I'll find some testing time tomorrow.

Thanks.

--
Regards,
----------------------------------------------------------------  -o)
Matthijs Melchior                                       Maarssen  /\\
mmelchior@xxxxxxxxx                                  Netherlands _\_v
---------------------------------------------------------------- ----

--- ./ethereal-0.9.11/epan/plugins.c-ORG	Wed Apr 30 15:43:08 2003
+++ ./ethereal-0.9.11/epan/plugins.c	Wed Apr 30 16:23:02 2003
@@ -517,6 +517,22 @@
 	patable.p_asn1_oid_decode		= asn1_oid_decode;
 	patable.p_asn1_sequence_decode		= asn1_sequence_decode;
 	patable.p_asn1_err_to_str		= asn1_err_to_str;
+
+	patable.p_except_init			= except_init;
+	patable.p_except_deinit			= except_deinit;
+	patable.p_except_rethrow		= except_rethrow;
+	patable.p_except_throw			= except_throw;
+	patable.p_except_throwd			= except_throwd;
+	patable.p_except_throwf			= except_throwf;
+	patable.p_except_unhandled_catcher	= except_unhandled_catcher;
+	patable.p_except_code			= except_code;
+	patable.p_except_group			= except_group;
+	patable.p_except_message	       	= except_message;
+	patable.p_except_data			= except_data;
+	patable.p_except_take_data	       	= except_take_data;
+	patable.p_except_set_allocator		= except_set_allocator;
+	patable.p_except_alloc			= except_alloc;
+	patable.p_except_free			= except_free;
 	
 #endif
 
--- ./ethereal-0.9.11/plugins/plugin_api.c-ORG	Wed Apr 30 15:43:08 2003
+++ ./ethereal-0.9.11/plugins/plugin_api.c	Wed Apr 30 16:33:26 2003
@@ -239,4 +239,20 @@
 	p_asn1_sequence_decode			= pat->p_asn1_sequence_decode;
 	p_asn1_err_to_str			= pat->p_asn1_err_to_str;
 
+	p_except_init				= pat->p_except_init;
+	p_except_deinit				= pat->p_except_deinit;
+	p_except_rethrow			= pat->p_except_rethrow;
+	p_except_throw				= pat->p_except_throw;
+	p_except_throwd				= pat->p_except_throwd;
+	p_except_throwf				= pat->p_except_throwf;
+	p_except_unhandled_catcher     		= pat->p_except_unhandled_catcher;
+	p_except_code				= pat->p_except_code;
+	p_except_group				= pat->p_except_group;
+	p_except_message			= pat->p_except_message;
+	p_except_data				= pat->p_except_data;
+	p_except_take_data			= pat->p_except_take_data;
+	p_except_set_allocator			= pat->p_except_set_allocator;
+	p_except_alloc				= pat->p_except_alloc;
+	p_except_free				= pat->p_except_free;
+
 }
--- ./ethereal-0.9.11/plugins/plugin_api.h-ORG	Wed Apr 30 15:43:08 2003
+++ ./ethereal-0.9.11/plugins/plugin_api.h	Wed Apr 30 16:42:49 2003
@@ -269,6 +269,22 @@
 #define	asn1_sequence_decode		(*p_asn1_sequence_decode)
 #define	asn1_err_to_str			(*p_asn1_err_to_str)
 
+#define except_init			(*p_except_init)
+#define except_deinit			(*p_except_deinit)
+#define except_rethrow			(*p_except_rethrow)
+#define except_throw			(*p_except_throw)
+#define except_throwd			(*p_except_throwd)
+#define except_throwf			(*p_except_throwf)
+#define except_unhandled_catcher       	(*p_except_unhandled_catcher)
+#define except_code			(*p_except_code)
+#define except_group			(*p_except_group)
+#define except_message			(*p_except_message)
+#define except_data			(*p_except_data)
+#define except_take_data	       	(*p_except_take_data)
+#define except_set_allocator	       	(*p_except_set_allocator)
+#define except_alloc			(*p_except_alloc)
+#define except_free			(*p_except_free)
+
 #endif
 
 #include <epan/packet.h>
@@ -280,6 +296,7 @@
 #include "packet-tcp.h"
 #include "tap.h"
 #include "asn1.h"
+#include "epan/except.h"
 
 #include "plugin_table.h"
 
--- ./ethereal-0.9.11/plugins/plugin_api_decls.h-ORG	Wed Apr 30 15:43:08 2003
+++ ./ethereal-0.9.11/plugins/plugin_api_decls.h	Wed Apr 30 16:48:55 2003
@@ -277,3 +277,19 @@
 addr_asn1_oid_decode			p_asn1_oid_decode;
 addr_asn1_sequence_decode		p_asn1_sequence_decode;
 addr_asn1_err_to_str			p_asn1_err_to_str;
+
+addr_except_init			p_except_init;
+addr_except_deinit			p_except_deinit;
+addr_except_rethrow			p_except_rethrow;
+addr_except_throw			p_except_throw;
+addr_except_throwd			p_except_throwd;
+addr_except_throwf			p_except_throwf;
+addr_except_unhandled_catcher		p_except_unhandled_catcher;
+addr_except_code			p_except_code;
+addr_except_group			p_except_group;
+addr_except_message			p_except_message;
+addr_except_data			p_except_data;
+addr_except_take_data			p_except_take_data;
+addr_except_set_allocator		p_except_set_allocator;
+addr_except_alloc			p_except_alloc;
+addr_except_free			p_except_free;
--- ./ethereal-0.9.11/plugins/plugin_table.h-ORG	Wed Apr 30 16:09:58 2003
+++ ./ethereal-0.9.11/plugins/plugin_table.h	Wed Apr 30 17:03:10 2003
@@ -314,6 +314,22 @@
 
 typedef char *(*addr_asn1_err_to_str)(int );
 
+typedef int (*except_init)(void);
+typedef void (*except_deinit)(void);
+typedef void (*except_rethrow)(except_t *);
+typedef void (*except_throw)(long, long, const char *);
+typedef void (*except_throwd)(long, long, const char *, void *);
+typedef void (*except_throwf)(long, long, const char *, ...);
+typedef void (*(*except_unhandled_catcher)(void (*)(except_t *)))(except_t *);
+typedef unsigned long (*except_code)(except_t *);
+typedef unsigned long (*except_group)(except_t *);
+typedef const char *(*except_message)(except_t *);
+typedef void *(*except_data)(except_t *);
+typedef void *(*except_take_data)(except_t *);
+typedef void (*except_set_allocator)(void *(*)(size_t), void (*)(void *));
+typedef void *(*except_alloc)(size_t);
+typedef void (*except_free)(void *);
+
 typedef struct  {
 
 #include "plugin_api_decls.h"