Ethereal-dev: Re: [Ethereal-dev] Plugin API

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

Date Prev · Date Next · Thread Prev · Thread Next
From: Tomas Kukosa <tomas.kukosa@xxxxxxxxxx>
Date: Thu, 01 Nov 2001 09:43:31 +0100
> > However, the changes that should be made are changes to the header files
> > that declare the functions in question; those header files should be
> > changed to add "extern",
> 
> I've checked in changes to do that, so *if* you compile from the current
> CVS code, or wait for the next release, you should be able to build, on
> Windows, a plugin that's built from more than one source file.

It works fine. Thanks.

Some mistakes seem to be in plugin_api_defs.h. Second parameters of
following functions have different type than new version of tvbuff.*.

gint (*p_tvb_find_guint8)(tvbuff_t*, gint, guint, guint8);
should be
gint (*p_tvb_find_guint8)(tvbuff_t*, gint, gint, guint8);

gint (*p_tvb_pbrk_guint8)(tvbuff_t *, gint, guint, guint8 *);
should be
gint (*p_tvb_pbrk_guint8)(tvbuff_t *, gint, gint, guint8 *);

Would not be better write plugin_api_defs.h in following form?
addr_check_col    p_check_col;
addr_col_clear    p_col_clear;
addr_col_add_fstr p_col_add_fstr;
...
It would require less effort for changes.


Could you add to Plugin API some additional function from packet.h,
conversation.h and value_string.h? Lines of source code are below.
  Regards,
    Tom Kukosa


--- plugins.c --------------------------------------------
	patable.p_register_init_routine		= register_init_routine;
	patable.p_conv_dissector_add		= conv_dissector_add;
	patable.p_conversation_new		= conversation_new;
	patable.p_find_conversation		= find_conversation;
        patable.p_match_strval                  = match_strval;
        patable.p_val_to_str                    = val_to_str;
--- pugin_api.c -----------------------------------------
	p_register_init_routine			= pat->p_register_init_routine;
	p_conv_dissector_add			= pat->p_conv_dissector_add;
	p_conversation_new			= pat->p_conversation_new;
	p_find_conversation			= pat->p_find_conversation;
	p_match_strval				= pat->p_match_strval;
	p_val_to_str		 		= pat->p_val_to_str;
--- plugin_table.h -------------------------------------
typedef void (*addr_register_init_routine)(void (*func)(void));
typedef void (*addr_conv_dissector_add)(const char *, dissector_t, int);
typedef conversation_t *(*addr_conversation_new)(address *, address *, 
	port_type, guint32, guint32, guint);
typedef conversation_t *(*addr_find_conversation)(address *, address *, 
	port_type, guint32, guint32, guint);
typedef gchar* (*addr_match_strval)(guint32, const value_string*);
typedef gchar* (*addr_val_to_str)(guint32, const value_string *, const
char *);
...
	addr_register_init_routine		p_register_init_routine;
	addr_conv_dissector_add			p_conv_dissector_add;
	addr_conversation_new			p_conversation_new;
	addr_find_conversation			p_find_conversation;
	addr_match_strval			p_match_strval;
	addr_val_to_str				p_val_to_str;
--- plugin_api.h ---------------------------------------
#define register_init_routine		(*p_register_init_routine)
#define conv_dissector_add		(*p_conv_dissector_add)
#define conversation_new		(*p_conversation_new)
#define find_conversation		(*p_find_conversation)
#define match_strval			(*p_match_strval)
#define val_to_str			(*p_val_to_str)
--- plugin_api_defs.h ----------------------------------
void (*p_register_init_routine)(void (*func)(void));
void (*p_conv_dissector_add)(const char *, dissector_t, int);
conversation_t *(*p_conversation_new)(address *, address *, 
	port_type, guint32, guint32, guint);
conversation_t *(*p_find_conversation)(address *, address *, 
	port_type, guint32, guint32, guint);
gchar* (*p_match_strval)(guint32, const value_string*);
gchar* (*p_val_to_str)(guint32, const value_string *, const char *);
/* or other approach */
addr_register_init_routine	p_register_init_routine;
addr_conv_dissector_add		p_conv_dissector_add;
addr_conversation_new		p_conversation_new;
addr_find_conversation		p_find_conversation;
addr_match_strval		p_match_strval;
addr_val_to_str			p_val_to_str;