Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] libethereal shared lib TODOs

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

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Thu, 18 Mar 2004 13:09:48 +0100
Hi list,

The last 7 days I have been trying to find out why building a
*shared* libethereal does not work today. Fortunately (?)
CygWin gcc does not allow "declared but not defined" objects
in a shared library. As such, it was very simple to find the
major issues today. When I fixed the missing linkage of the
PCRE and Z libraries, there remained only 2 missing objects:
the global variable timestamp_type and the
report_open_failure() method.

If we want to build a true shared library, then we
imperatively MUST have a self-contained library, hence we
MUST get rid of the missing objects which were declared but
not defined. Below you'll find a summary of the problem
analysis and possible TODOs.

1. References to timestamp_type
===============================

epan/timestamp.h
*	Defines ts_type enum and TS_NOT_SET.
*	Declares extern ts_type timestamp_type;

Notes:
*	The ts_type enum is never used in epan or epan/*
*	The timestamp_type is used in column-utils.c in a
	switch(timestamp_type) {}
*	The timestamp.h header is included in column-utils.c
	and in packet.c. It is not used in the latter however.

Proposed short-term MT-unsafe fix:
*	Remove unneeded timestamp.h inclusion in packet.c
	(this is safe)
*	Add timestamp.c defining timestamp_type and public
	set/get functions void epan_set_timestamp_type(ts_type)
	and ts_type epan_get_timestamp_type(void).
*	Add the public set/get function prototypes to
	timestamp.h
*	Update the following files so they use the accessor
	methods for the variable now hidden within libethereal:
	column.c dftest.c globals.h gtk/main.c gtk/packet_win.c
	packet-frame.c tethereal.c

References to report_open_failure()
===================================
report_err.h
*	Declares report_open_failure() and
	report_read_failure() as external functions.

plugins/Xplugin_api.h
*	Define:
	#define report_open_failure (*p_report_open_failure)
*	Define:
	#define report_read_failure (*p_report_read_failure)

plugins/plugin_api_list.c
*	Declares report_open_failure() and
	report_read_failure() as *non-external* functions.

Notes:
*	The report_open_failure() function is defined in
	alert_box.c dftest.c tethereal.c
*	The following files include the report_err.h header:
	alert_box.c epan/plugins.c packet-diameter.c
	plugins/asn1/packet-asn1.c
	plugins/plugin_api.h
	plugins/plugin_api_list.c tethereal.c

Proposed short-term MT-unsafe fix:
*	Remove the report_XXX_failure() methods from
	libethereal and provide additional global variables
	for epan errors. Either return the error code as a
	side-effect from calling a function in epan, or
	explicitly demand the caller to inspect the error
	variables after such an epan function call.

Proposed long-term MT-safe fix:
*	Get rid of those dangerous global variables
*	Define a "capture object" within which capture globals
	are being defined. This will require much rework of the
	epan API as we need to pass this "capture object" for
	almost every epan call.

Please comment.

Regards,

Olivier