forked from osmocom/wireshark
epan: Remove unnecessary all protocols registration callback
We are exporting a registration function from libwireshark just to have it passed back as a callback. Seems unnecessary. Change-Id: I7621005c9be11691d319102326824c5e3520a6f3 Reviewed-on: https://code.wireshark.org/review/29328 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>thomas/dect
parent
b6ba314466
commit
8eddb1650d
|
@ -1296,8 +1296,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
|
|||
reassembly_table_init@Base 1.9.1
|
||||
reassembly_table_register@Base 2.3.0
|
||||
register_all_plugin_tap_listeners@Base 2.5.0
|
||||
register_all_protocol_handoffs@Base 1.9.1
|
||||
register_all_protocols@Base 1.9.1
|
||||
register_ber_oid_dissector@Base 2.1.0
|
||||
register_ber_oid_dissector_handle@Base 1.9.1
|
||||
register_ber_oid_syntax@Base 1.9.1
|
||||
|
@ -1307,7 +1305,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
|
|||
register_cleanup_routine@Base 1.99.8
|
||||
register_conversation_filter@Base 2.0.0
|
||||
register_conversation_table@Base 2.5.0
|
||||
register_count@Base 1.9.1
|
||||
register_custom_dissector_table@Base 1.99.8
|
||||
register_custom_dissector_table@Base 1.99.8
|
||||
register_decode_as@Base 1.12.0~rc1
|
||||
|
|
4
dftest.c
4
dftest.c
|
@ -33,7 +33,6 @@
|
|||
#include <wiretap/wtap.h>
|
||||
|
||||
#include "ui/util.h"
|
||||
#include "epan/register.h"
|
||||
|
||||
static void failure_warning_message(const char *msg_format, va_list ap);
|
||||
static void open_failure_message(const char *filename, int err,
|
||||
|
@ -78,8 +77,7 @@ main(int argc, char **argv)
|
|||
"-g" flag, as the "-g" flag dumps a list of fields registered
|
||||
by the dissectors, and we must do it before we read the preferences,
|
||||
in case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs,
|
||||
NULL, NULL))
|
||||
if (!epan_init(NULL, NULL))
|
||||
return 2;
|
||||
|
||||
/* set the c-language locale to the native environment. */
|
||||
|
|
25
epan/epan.c
25
epan/epan.c
|
@ -88,8 +88,8 @@
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
static GSList *epan_register_all_procotols = NULL;
|
||||
static GSList *epan_register_all_handoffs = NULL;
|
||||
static GSList *epan_plugin_register_all_procotols = NULL;
|
||||
static GSList *epan_plugin_register_all_handoffs = NULL;
|
||||
|
||||
static wmem_allocator_t *pinfo_pool_cache = NULL;
|
||||
|
||||
|
@ -169,17 +169,14 @@ void epan_register_plugin(const epan_plugin *plug)
|
|||
{
|
||||
epan_plugins = g_slist_prepend(epan_plugins, (epan_plugin *)plug);
|
||||
if (plug->register_all_protocols)
|
||||
epan_register_all_procotols = g_slist_prepend(epan_register_all_procotols, plug->register_all_protocols);
|
||||
epan_plugin_register_all_procotols = g_slist_prepend(epan_plugin_register_all_procotols, plug->register_all_protocols);
|
||||
if (plug->register_all_handoffs)
|
||||
epan_register_all_handoffs = g_slist_prepend(epan_register_all_handoffs, plug->register_all_handoffs);
|
||||
epan_plugin_register_all_handoffs = g_slist_prepend(epan_plugin_register_all_handoffs, plug->register_all_handoffs);
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
|
||||
void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
|
||||
register_cb cb,
|
||||
gpointer client_data)
|
||||
epan_init(register_cb cb, gpointer client_data)
|
||||
{
|
||||
volatile gboolean status = TRUE;
|
||||
|
||||
|
@ -236,9 +233,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
|
|||
#ifdef HAVE_PLUGINS
|
||||
g_slist_foreach(epan_plugins, epan_plugin_init, NULL);
|
||||
#endif
|
||||
epan_register_all_procotols = g_slist_prepend(epan_register_all_procotols, register_all_protocols_func);
|
||||
epan_register_all_handoffs = g_slist_prepend(epan_register_all_handoffs, register_all_handoffs_func);
|
||||
proto_init(epan_register_all_procotols, epan_register_all_handoffs, cb, client_data);
|
||||
proto_init(epan_plugin_register_all_procotols, epan_plugin_register_all_handoffs, cb, client_data);
|
||||
packet_cache_proto_handles();
|
||||
dfilter_init();
|
||||
final_registration_all_protocols();
|
||||
|
@ -301,10 +296,10 @@ epan_cleanup(void)
|
|||
g_slist_free(epan_plugins);
|
||||
epan_plugins = NULL;
|
||||
#endif
|
||||
g_slist_free(epan_register_all_procotols);
|
||||
epan_register_all_procotols = NULL;
|
||||
g_slist_free(epan_register_all_handoffs);
|
||||
epan_register_all_handoffs = NULL;
|
||||
g_slist_free(epan_plugin_register_all_procotols);
|
||||
epan_plugin_register_all_procotols = NULL;
|
||||
g_slist_free(epan_plugin_register_all_handoffs);
|
||||
epan_plugin_register_all_handoffs = NULL;
|
||||
|
||||
dfilter_cleanup();
|
||||
decode_clear_all();
|
||||
|
|
|
@ -19,7 +19,7 @@ extern "C" {
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/frame_data.h>
|
||||
#include <wsutil/plugins.h>
|
||||
#include "register.h"
|
||||
#include <epan/register.h>
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
typedef struct epan_dissect epan_dissect_t;
|
||||
|
@ -100,9 +100,7 @@ Ref2 for further edits - delete when done
|
|||
* Returns TRUE on success, FALSE on failure.
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
gboolean epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
|
||||
void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
|
||||
register_cb cb, void *client_data);
|
||||
gboolean epan_init(register_cb cb, void *client_data);
|
||||
|
||||
/**
|
||||
* Load all settings, from the current profile, that affect epan.
|
||||
|
|
20
epan/proto.c
20
epan/proto.c
|
@ -42,6 +42,7 @@
|
|||
#include "expert.h"
|
||||
#include "show_exception.h"
|
||||
#include "in_cksum.h"
|
||||
#include "register-int.h"
|
||||
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf/ws_g_warning */
|
||||
#include <wsutil/crash_info.h>
|
||||
|
@ -448,8 +449,8 @@ call_plugin_register_handoff(gpointer data, gpointer user_data _U_)
|
|||
|
||||
/* initialize data structures and register protocols and fields */
|
||||
void
|
||||
proto_init(GSList *register_all_protocols_list,
|
||||
GSList *register_all_handoffs_list,
|
||||
proto_init(GSList *register_all_plugin_protocols_list,
|
||||
GSList *register_all_plugin_handoffs_list,
|
||||
register_cb cb,
|
||||
gpointer client_data)
|
||||
{
|
||||
|
@ -486,13 +487,15 @@ proto_init(GSList *register_all_protocols_list,
|
|||
dissector tables, and dissectors to be called through a
|
||||
handle, and do whatever one-time initialization it needs to
|
||||
do. */
|
||||
for (GSList *l = register_all_protocols_list; l != NULL; l = l->next) {
|
||||
register_all_protocols(cb, client_data);
|
||||
|
||||
/* Now call the registration routines for all epan plugins. */
|
||||
for (GSList *l = register_all_plugin_protocols_list; l != NULL; l = l->next) {
|
||||
((void (*)(register_cb, gpointer))l->data)(cb, client_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/* Now call the registration routines for all disssector
|
||||
plugins. */
|
||||
/* Now call the registration routines for all dissector plugins. */
|
||||
if (cb)
|
||||
(*cb)(RA_PLUGIN_REGISTER, NULL, client_data);
|
||||
g_slist_foreach(dissector_plugins, call_plugin_register_protoinfo, NULL);
|
||||
|
@ -502,12 +505,15 @@ proto_init(GSList *register_all_protocols_list,
|
|||
dissectors; those routines register the dissector in other
|
||||
dissectors' handoff tables, and fetch any dissector handles
|
||||
they need. */
|
||||
for (GSList *l = register_all_handoffs_list; l != NULL; l = l->next) {
|
||||
register_all_protocol_handoffs(cb, client_data);
|
||||
|
||||
/* Now do the same with epan plugins. */
|
||||
for (GSList *l = register_all_plugin_handoffs_list; l != NULL; l = l->next) {
|
||||
((void (*)(register_cb, gpointer))l->data)(cb, client_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/* Now do the same with plugins. */
|
||||
/* Now do the same with dissector plugins. */
|
||||
if (cb)
|
||||
(*cb)(RA_PLUGIN_HANDOFF, NULL, client_data);
|
||||
g_slist_foreach(dissector_plugins, call_plugin_register_handoff, NULL);
|
||||
|
|
|
@ -907,8 +907,9 @@ WS_DLL_PUBLIC void proto_register_plugin(const proto_plugin *plugin);
|
|||
#endif
|
||||
|
||||
/** Sets up memory used by proto routines. Called at program startup */
|
||||
void proto_init(GSList *register_all_protocols_list, GSList *register_all_handoffs_list,
|
||||
register_cb cb, void *client_data);
|
||||
void proto_init(GSList *register_all_plugin_protocols_list,
|
||||
GSList *register_all_plugin_handoffs_list,
|
||||
register_cb cb, void *client_data);
|
||||
|
||||
|
||||
/** Frees memory used by proto routines. Called at program shutdown */
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/* register-int.h
|
||||
* Definitions for protocol registration
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef __REGISTER_INT_H__
|
||||
#define __REGISTER_INT_H__
|
||||
|
||||
#include "register.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** Call each dissector's protocol registration routine.
|
||||
*
|
||||
* Each routine is called in alphabetical order from a worker thread.
|
||||
* Registration routines might call any number of routines which are not
|
||||
* thread safe, such as wmem_alloc. Callbacks should handle themselves
|
||||
* accordingly.
|
||||
*
|
||||
* @param cb Callback routine which is called for each protocol.
|
||||
* Messages have the format "proto_register_XXX".
|
||||
* @param client_data Data pointer for the callback.
|
||||
*/
|
||||
void register_all_protocols(register_cb cb, gpointer client_data);
|
||||
|
||||
/** Call each dissector's protocol handoff routine.
|
||||
*
|
||||
* Each routine is called from a worker thread. Registration routines
|
||||
* might call any number of routines which are not thread safe, such as
|
||||
* wmem_alloc. Callbacks should handle themselves accordingly.
|
||||
*
|
||||
* @param cb Callback routine which is called for each protocol.
|
||||
* Messages have the format "proto_reg_handoff_XXX".
|
||||
* @param client_data Data pointer for the callback.
|
||||
*/
|
||||
void register_all_protocol_handoffs(register_cb cb, gpointer client_data);
|
||||
|
||||
gulong register_count(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __REGISTER_INT_H__ */
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
|
@ -11,12 +11,6 @@
|
|||
#ifndef __REGISTER_H__
|
||||
#define __REGISTER_H__
|
||||
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef enum {
|
||||
|
@ -38,37 +32,6 @@ typedef enum {
|
|||
|
||||
typedef void (*register_cb)(register_action_e action, const char *message, gpointer client_data);
|
||||
|
||||
/** Call each dissector's protocol registration routine.
|
||||
*
|
||||
* Each routine is called in alphabetical order from a worker thread.
|
||||
* Registration routines might call any number of routines which are not
|
||||
* thread safe, such as wmem_alloc. Callbacks should handle themselves
|
||||
* accordingly.
|
||||
*
|
||||
* @param cb Callback routine which is called for each protocol.
|
||||
* Messages have the format "proto_register_XXX".
|
||||
* @param client_data Data pointer for the callback.
|
||||
*/
|
||||
WS_DLL_PUBLIC void register_all_protocols(register_cb cb, gpointer client_data);
|
||||
|
||||
/** Call each dissector's protocol handoff routine.
|
||||
*
|
||||
* Each routine is called from a worker thread. Registration routines
|
||||
* might call any number of routines which are not thread safe, such as
|
||||
* wmem_alloc. Callbacks should handle themselves accordingly.
|
||||
*
|
||||
* @param cb Callback routine which is called for each protocol.
|
||||
* Messages have the format "proto_reg_handoff_XXX".
|
||||
* @param client_data Data pointer for the callback.
|
||||
*/
|
||||
WS_DLL_PUBLIC void register_all_protocol_handoffs(register_cb cb, gpointer client_data);
|
||||
|
||||
WS_DLL_PUBLIC gulong register_count(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __REGISTER_H__ */
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <epan/packet_info.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/stat_groups.h>
|
||||
#include "register.h"
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "epan/register.h"
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
WS_DLL_PUBLIC int wslua_count_plugins(void);
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#include "ui/util.h"
|
||||
#include "ui/dissect_opts.h"
|
||||
#include "ui/failure_message.h"
|
||||
#include "epan/register.h"
|
||||
#include "conditions.h"
|
||||
#include "capture_stop_conditions.h"
|
||||
#include <epan/epan_dissect.h>
|
||||
|
@ -520,8 +519,7 @@ main(int argc, char *argv[])
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs,
|
||||
NULL, NULL)) {
|
||||
if (!epan_init(NULL, NULL)) {
|
||||
ret = INIT_ERROR;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
|
4
sharkd.c
4
sharkd.c
|
@ -49,7 +49,6 @@
|
|||
#include "ui/filter_files.h"
|
||||
#include "ui/tap_export_pdu.h"
|
||||
#include "ui/failure_message.h"
|
||||
#include "epan/register.h"
|
||||
#include <epan/epan_dissect.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/uat-int.h>
|
||||
|
@ -168,8 +167,7 @@ main(int argc, char *argv[])
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs, NULL,
|
||||
NULL)) {
|
||||
if (!epan_init(NULL, NULL)) {
|
||||
ret = EPAN_INIT_FAIL;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "ui/util.h"
|
||||
#include "ui/decode_as_utils.h"
|
||||
#include "ui/dissect_opts.h"
|
||||
#include "epan/register.h"
|
||||
#include <epan/epan_dissect.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/stat_tap_ui.h>
|
||||
|
@ -491,8 +490,7 @@ main(int argc, char *argv[])
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs, NULL,
|
||||
NULL)) {
|
||||
if (!epan_init(NULL, NULL)) {
|
||||
exit_status = INIT_ERROR;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ fuzz_init(int argc _U_, char **argv)
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs, NULL, NULL))
|
||||
if (!epan_init(NULL, NULL))
|
||||
{
|
||||
ret = EPAN_INIT_FAIL;
|
||||
goto clean_exit;
|
||||
|
|
4
tshark.c
4
tshark.c
|
@ -86,7 +86,6 @@
|
|||
#include "epan/oids.h"
|
||||
#endif
|
||||
#include "epan/maxmind_db.h"
|
||||
#include "epan/register.h"
|
||||
#include <epan/epan_dissect.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/stat_tap_ui.h>
|
||||
|
@ -924,8 +923,7 @@ main(int argc, char *argv[])
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols, register_all_protocol_handoffs, NULL,
|
||||
NULL)) {
|
||||
if (!epan_init(NULL, NULL)) {
|
||||
exit_status = INIT_FAILED;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#endif
|
||||
|
||||
#include "log.h"
|
||||
#include "epan/register.h"
|
||||
|
||||
#include "ui/alert_box.h"
|
||||
#include "ui/last_open_dir.h"
|
||||
|
|
|
@ -618,8 +618,7 @@ int main(int argc, char *qt_argv[])
|
|||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
case any dissectors register preferences. */
|
||||
if (!epan_init(register_all_protocols,register_all_protocol_handoffs,
|
||||
splash_update, NULL)) {
|
||||
if (!epan_init(splash_update, NULL)) {
|
||||
SimpleDialog::displayQueuedMessages(main_w);
|
||||
ret_val = INIT_FAILED;
|
||||
goto clean_exit;
|
||||
|
|
Loading…
Reference in New Issue