aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2008-10-25 20:24:31 +0000
committerBill Meier <wmeier@newsguy.com>2008-10-25 20:24:31 +0000
commit05c1929f1d51ef94a5827147aee61d2320434783 (patch)
tree3e6cc68f2dc569fe027498b7deb3d0574cd99c09
parent94c73a47c9e361b6eeeecf53e9b600f9cf1b77a9 (diff)
proto_register/proto_reg_handoff; Various small cleanup and bug-fixing
remove unnecessary #include prefs.f and emem.h in a few cases... svn path=/trunk/; revision=26554
-rw-r--r--plugins/agentx/packet-agentx.c9
-rw-r--r--plugins/artnet/packet-artnet.c12
-rw-r--r--plugins/enttec/packet-enttec.c16
-rw-r--r--plugins/ethercat/packet-ams.c11
-rw-r--r--plugins/ethercat/packet-ecatmb.c9
-rw-r--r--plugins/ethercat/packet-ethercat-datagram.c4
-rw-r--r--plugins/ethercat/packet-ethercat-frame.c6
-rw-r--r--plugins/ethercat/packet-ioraw.c4
-rw-r--r--plugins/ethercat/packet-nv.c4
-rw-r--r--plugins/irda/irda-appl.h4
-rw-r--r--plugins/irda/packet-ircomm.c6
-rw-r--r--plugins/irda/packet-irda.c2
-rw-r--r--plugins/irda/packet-sir.c6
-rw-r--r--plugins/lwres/packet-lwres.c22
-rw-r--r--plugins/m2m/packet-m2m.c33
-rw-r--r--plugins/opcua/opcua.c34
-rw-r--r--plugins/pcli/packet-pcli.c7
-rw-r--r--plugins/profinet/packet-pn-rt.c22
-rw-r--r--plugins/rtnet/packet-rtnet.c33
-rw-r--r--plugins/sbus/packet-sbus.c3
-rw-r--r--plugins/sercosiii/packet-sercosiii_1v1.c17
21 files changed, 79 insertions, 185 deletions
diff --git a/plugins/agentx/packet-agentx.c b/plugins/agentx/packet-agentx.c
index 8c02c8a9d7..079afbc5c5 100644
--- a/plugins/agentx/packet-agentx.c
+++ b/plugins/agentx/packet-agentx.c
@@ -42,7 +42,6 @@
#include <epan/dissectors/packet-tcp.h>
static guint global_agentx_tcp_port = 705;
-static guint agentx_tcp_port = 705;
void proto_reg_handoff_agentx(void);
@@ -1089,26 +1088,24 @@ proto_register_agentx(void)
"Set the TCP port for AgentX"
"(if other than the default of 705)",
10, &global_agentx_tcp_port);
-
}
/* The registration hand-off routine */
void
proto_reg_handoff_agentx(void)
{
- static int agentx_prefs_initialized = FALSE;
+ static gboolean agentx_prefs_initialized = FALSE;
static dissector_handle_t agentx_handle;
+ static guint agentx_tcp_port;
if(!agentx_prefs_initialized) {
agentx_handle = create_dissector_handle(dissect_agentx, proto_agentx);
agentx_prefs_initialized = TRUE;
}
else {
- dissector_delete("tcp.port",global_agentx_tcp_port, agentx_handle);
-
+ dissector_delete("tcp.port", agentx_tcp_port, agentx_handle);
}
agentx_tcp_port = global_agentx_tcp_port;
-
dissector_add("tcp.port", agentx_tcp_port, agentx_handle);
}
diff --git a/plugins/artnet/packet-artnet.c b/plugins/artnet/packet-artnet.c
index c0eecb7e8a..1ebe60d3f2 100644
--- a/plugins/artnet/packet-artnet.c
+++ b/plugins/artnet/packet-artnet.c
@@ -479,13 +479,11 @@ static int ett_artnet = -1;
*/
static guint global_udp_port_artnet = UDP_PORT_ARTNET;
-static guint udp_port_artnet = UDP_PORT_ARTNET;
static gint global_disp_chan_val_type = 0;
static gint global_disp_col_count = 16;
static gint global_disp_chan_nr_type = 0;
-/* A static handle for the ip dissector */
-static dissector_handle_t ip_handle;
+/* A static handle for the rdm dissector */
static dissector_handle_t rdm_handle;
static guint
@@ -2689,15 +2687,13 @@ proto_register_artnet(void) {
void
proto_reg_handoff_artnet(void) {
- static int artnet_initialized = FALSE;
+ static gboolean artnet_initialized = FALSE;
static dissector_handle_t artnet_handle;
-
- ip_handle = find_dissector("ip");
- rdm_handle = find_dissector("rdm");
-
+ static guint udp_port_artnet;
if(!artnet_initialized) {
artnet_handle = create_dissector_handle(dissect_artnet,proto_artnet);
+ rdm_handle = find_dissector("rdm");
artnet_initialized = TRUE;
} else {
dissector_delete("udp.port",udp_port_artnet,artnet_handle);
diff --git a/plugins/enttec/packet-enttec.c b/plugins/enttec/packet-enttec.c
index 0db1ae1d99..7c5e277fdb 100644
--- a/plugins/enttec/packet-enttec.c
+++ b/plugins/enttec/packet-enttec.c
@@ -119,20 +119,12 @@ static int ett_enttec = -1;
*/
static guint global_udp_port_enttec = UDP_PORT_ENTTEC;
-static guint udp_port_enttec = UDP_PORT_ENTTEC;
-
static guint global_tcp_port_enttec = TCP_PORT_ENTTEC;
-static guint tcp_port_enttec = TCP_PORT_ENTTEC;
static gint global_disp_chan_val_type = 0;
static gint global_disp_col_count = 16;
static gint global_disp_chan_nr_type = 0;
-
-/* A static handle for the ip dissector */
-static dissector_handle_t ip_handle;
-static dissector_handle_t rdm_handle;
-
static gint
dissect_enttec_poll_reply(tvbuff_t *tvb, guint offset, proto_tree *tree)
{
@@ -551,12 +543,10 @@ proto_register_enttec(void)
/* The registration hand-off routing */
void
proto_reg_handoff_enttec(void) {
- static int enttec_initialized = FALSE;
+ static gboolean enttec_initialized = FALSE;
static dissector_handle_t enttec_handle;
-
- ip_handle = find_dissector("ip");
- rdm_handle = find_dissector("rdm");
-
+ static guint udp_port_enttec;
+ static guint tcp_port_enttec;
if(!enttec_initialized) {
enttec_handle = create_dissector_handle(dissect_enttec,proto_enttec);
diff --git a/plugins/ethercat/packet-ams.c b/plugins/ethercat/packet-ams.c
index c58d8fa11b..f857ad0862 100644
--- a/plugins/ethercat/packet-ams.c
+++ b/plugins/ethercat/packet-ams.c
@@ -39,14 +39,10 @@
#include <glib.h>
#include <epan/packet.h>
-#include <epan/prefs.h>
#include <epan/strutil.h>
-#include <epan/emem.h>
#include "packet-ams.h"
-void proto_reg_handoff_ams(void);
-
/* Define the ams proto */
int proto_ams = -1;
@@ -1226,8 +1222,7 @@ void proto_register_ams(void)
&ett_ams_adsdnrequest
};
- proto_ams = proto_register_protocol("AMS",
- "AMS", "ams");
+ proto_ams = proto_register_protocol("AMS", "AMS", "ams");
proto_register_field_array(proto_ams, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@@ -1238,9 +1233,9 @@ void proto_register_ams(void)
void proto_reg_handoff_ams(void)
{
- static dissector_handle_t ams_handle;
+ dissector_handle_t ams_handle;
- ams_handle = create_dissector_handle(dissect_ams, proto_ams);
+ ams_handle = find_dissector("ams");
dissector_add("tcp.port", 0xbf02, ams_handle);
dissector_add("ecatf.type", 2, ams_handle);
}
diff --git a/plugins/ethercat/packet-ecatmb.c b/plugins/ethercat/packet-ecatmb.c
index c850ad3e57..d77d3cfe25 100644
--- a/plugins/ethercat/packet-ecatmb.c
+++ b/plugins/ethercat/packet-ecatmb.c
@@ -40,15 +40,10 @@
#include <epan/packet.h>
#include <epan/addr_resolv.h>
-#include <epan/prefs.h>
#include <epan/strutil.h>
-#include <epan/emem.h>
#include "packet-ecatmb.h"
-void proto_reg_handoff_ecat_mailbox(void);
-
-
#define BIT2BYTE(x) ((x+7)/8)
#define ENDOF(p) ((p)+1) /* pointer to end of *p */
@@ -2073,10 +2068,10 @@ void proto_register_ecat_mailbox(void)
void proto_reg_handoff_ecat_mailbox(void)
{
- static dissector_handle_t ecat_mailbox_handle;
+ dissector_handle_t ecat_mailbox_handle;
/* Register this dissector as a sub dissector to E88A4 based on ether type. */
- ecat_mailbox_handle = create_dissector_handle(dissect_ecat_mailbox, proto_ecat_mailbox);
+ ecat_mailbox_handle = find_dissector("ecat_mailbox");
dissector_add("ecatf.type", 5, ecat_mailbox_handle);
eth_handle = find_dissector("eth_withoutfcs");
diff --git a/plugins/ethercat/packet-ethercat-datagram.c b/plugins/ethercat/packet-ethercat-datagram.c
index 71e2d4ee06..e402f0b658 100644
--- a/plugins/ethercat/packet-ethercat-datagram.c
+++ b/plugins/ethercat/packet-ethercat-datagram.c
@@ -45,8 +45,6 @@
#include "packet-ethercat-datagram.h"
#include "packet-ecatmb.h"
-void proto_reg_handoff_ecat(void);
-
static heur_dissector_list_t heur_subdissector_list;
static dissector_handle_t ecat_mailbox_handle;
@@ -1707,7 +1705,7 @@ void proto_register_ecat(void)
/* The registration hand-off routing */
void proto_reg_handoff_ecat(void)
{
- static dissector_handle_t ecat_handle;
+ dissector_handle_t ecat_handle;
/* Register this dissector as a sub dissector to EtherCAT frame based on
ether type. */
diff --git a/plugins/ethercat/packet-ethercat-frame.c b/plugins/ethercat/packet-ethercat-frame.c
index c2d5845795..4ab5920932 100644
--- a/plugins/ethercat/packet-ethercat-frame.c
+++ b/plugins/ethercat/packet-ethercat-frame.c
@@ -45,8 +45,6 @@
#include "packet-ethercat-frame.h"
-void proto_reg_handoff_ethercat_frame(void);
-
/* Define the Ethercat frame proto */
static int proto_ethercat_frame = -1;
@@ -166,9 +164,9 @@ void proto_register_ethercat_frame(void)
void proto_reg_handoff_ethercat_frame(void)
{
- static dissector_handle_t ethercat_frame_handle;
+ dissector_handle_t ethercat_frame_handle;
- ethercat_frame_handle = create_dissector_handle(dissect_ethercat_frame, proto_ethercat_frame);
+ ethercat_frame_handle = find_dissector("ecatf");
dissector_add("ethertype", ETHERTYPE_ECATF, ethercat_frame_handle);
dissector_add("udp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
dissector_add("tcp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
diff --git a/plugins/ethercat/packet-ioraw.c b/plugins/ethercat/packet-ioraw.c
index f045fc7cc5..c6fb808d86 100644
--- a/plugins/ethercat/packet-ioraw.c
+++ b/plugins/ethercat/packet-ioraw.c
@@ -44,8 +44,6 @@
#include "packet-ioraw.h"
-void proto_reg_handoff_ioraw(void);
-
/* Define the ioraw proto */
int proto_ioraw = -1;
@@ -127,7 +125,7 @@ void proto_register_ioraw(void)
void proto_reg_handoff_ioraw(void)
{
- static dissector_handle_t ioraw_handle;
+ dissector_handle_t ioraw_handle;
ioraw_handle = create_dissector_handle(dissect_ioraw, proto_ioraw);
dissector_add("ecatf.type", 3, ioraw_handle);
diff --git a/plugins/ethercat/packet-nv.c b/plugins/ethercat/packet-nv.c
index eca2d27de5..49c7663b36 100644
--- a/plugins/ethercat/packet-nv.c
+++ b/plugins/ethercat/packet-nv.c
@@ -44,8 +44,6 @@
#include "packet-nv.h"
-void proto_reg_handoff_nv(void);
-
/* Define the nv proto */
int proto_nv = -1;
@@ -247,7 +245,7 @@ void proto_register_nv(void)
void proto_reg_handoff_nv(void)
{
- static dissector_handle_t nv_handle;
+ dissector_handle_t nv_handle;
nv_handle = create_dissector_handle(dissect_nv, proto_nv);
dissector_add("ecatf.type", 4, nv_handle);
diff --git a/plugins/irda/irda-appl.h b/plugins/irda/irda-appl.h
index b171f81f46..3aad917b85 100644
--- a/plugins/irda/irda-appl.h
+++ b/plugins/irda/irda-appl.h
@@ -73,10 +73,6 @@ extern void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp,
extern unsigned dissect_param_tuple(tvbuff_t* tvb, proto_tree* tree, unsigned offset);
-
-extern dissector_handle_t data_handle;
-
-
/*
* Protocol exports.
* Modify the lines below to add new protocols.
diff --git a/plugins/irda/packet-ircomm.c b/plugins/irda/packet-ircomm.c
index 900566ed40..ee7ce66a3e 100644
--- a/plugins/irda/packet-ircomm.c
+++ b/plugins/irda/packet-ircomm.c
@@ -132,6 +132,7 @@ static gint ett_ircomm_ctrl = -1;
#define MAX_PARAMETERS 32
static gint ett_param[MAX_IAP_ENTRIES * MAX_PARAMETERS];
+static dissector_handle_t data_handle;
static int proto_ircomm = -1;
static int hf_ircomm_param = -1;
@@ -438,3 +439,8 @@ void proto_register_ircomm(void)
}
proto_register_subtree_array(ett_p, MAX_IAP_ENTRIES * MAX_PARAMETERS);
}
+
+void
+proto_reg_handoff_ircomm(void) {
+ data_handle = find_dissector("data");
+}
diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c
index 7cb1f8eb5b..c80e419058 100644
--- a/plugins/irda/packet-irda.c
+++ b/plugins/irda/packet-irda.c
@@ -140,6 +140,8 @@
#define TTP_PARAMETERS 0x80
#define TTP_MORE 0x80
+static dissector_handle_t data_handle;
+
/* Initialize the protocol and registered fields */
static int proto_irlap = -1;
static int hf_lap_a = -1;
diff --git a/plugins/irda/packet-sir.c b/plugins/irda/packet-sir.c
index cf4fdb0310..3be593f426 100644
--- a/plugins/irda/packet-sir.c
+++ b/plugins/irda/packet-sir.c
@@ -49,8 +49,8 @@
/** Protocol handles. */
-dissector_handle_t data_handle;
-dissector_handle_t irda_handle;
+static dissector_handle_t data_handle;
+static dissector_handle_t irda_handle;
/** Protocol fields. */
static int proto_sir = -1;
@@ -186,7 +186,7 @@ proto_reg_handoff_irsir(void)
data_handle = find_dissector("data");
irda_handle = find_dissector("irda");
- if (irda_handle == 0)
+ if (irda_handle == NULL)
irda_handle = data_handle;
}
diff --git a/plugins/lwres/packet-lwres.c b/plugins/lwres/packet-lwres.c
index 42967ba256..1b53be2129 100644
--- a/plugins/lwres/packet-lwres.c
+++ b/plugins/lwres/packet-lwres.c
@@ -186,7 +186,6 @@ static int ett_ns_rec_item = -1;
#define LWRES_UDP_PORT 921
static guint global_lwres_port = LWRES_UDP_PORT;
-static guint lwres_port = LWRES_UDP_PORT;
void proto_reg_handoff_lwres(void);
@@ -1493,20 +1492,19 @@ proto_register_lwres(void)
void
proto_reg_handoff_lwres(void)
{
- static int lwres_prefs_initialized = FALSE;
+ static gboolean lwres_prefs_initialized = FALSE;
static dissector_handle_t lwres_handle;
+ static guint lwres_port;
if(!lwres_prefs_initialized) {
- lwres_handle = create_dissector_handle(dissect_lwres, proto_lwres);
- lwres_prefs_initialized = TRUE;
- }
- else {
- dissector_delete("udp.port",global_lwres_port, lwres_handle);
-
- }
-
- lwres_port = global_lwres_port;
+ lwres_handle = create_dissector_handle(dissect_lwres, proto_lwres);
+ lwres_prefs_initialized = TRUE;
+ }
+ else {
+ dissector_delete("udp.port", lwres_port, lwres_handle);
+ }
- dissector_add("udp.port", lwres_port, lwres_handle);
+ dissector_add("udp.port", global_lwres_port, lwres_handle);
+ lwres_port = global_lwres_port;
}
diff --git a/plugins/m2m/packet-m2m.c b/plugins/m2m/packet-m2m.c
index 77061ea8f5..99a4776be5 100644
--- a/plugins/m2m/packet-m2m.c
+++ b/plugins/m2m/packet-m2m.c
@@ -37,7 +37,6 @@
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
-#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/etypes.h>
#include <plugins/wimax/wimax_tlv.h>
@@ -60,7 +59,6 @@ guint g_frame_number = 0;
/* Local Variables */
static gint proto_m2m = -1;
-static dissector_handle_t m2m_handle = NULL;
static dissector_handle_t wimax_fch_burst_handle = NULL;
static dissector_handle_t wimax_cdma_code_burst_handle = NULL;
static dissector_handle_t wimax_pdu_burst_handle = NULL;
@@ -369,31 +367,24 @@ m2m_defragment_init(void)
/* Register Wimax Mac to Mac Protocol handler */
void proto_reg_handoff_m2m(void)
{
- static int Initialized = FALSE;
+ dissector_handle_t m2m_handle;
- if (!Initialized)
- {
- m2m_handle = create_dissector_handle(dissect_m2m, proto_m2m);
- dissector_add("ethertype", ETHERTYPE_WMX_M2M, m2m_handle);
- }
+ m2m_handle = create_dissector_handle(dissect_m2m, proto_m2m);
+ dissector_add("ethertype", ETHERTYPE_WMX_M2M, m2m_handle);
}
/* Register Wimax Mac to Mac Protocol */
void proto_register_m2m(void)
{
- if (proto_m2m == -1)
- {
- proto_m2m = proto_register_protocol (
- "WiMax Mac to Mac Packet", /* name */
- "M2M (m2m)", /* short name */
- "m2m" /* abbrev */
- );
-
- proto_register_field_array(proto_m2m, hf, array_length(hf));
- proto_register_field_array(proto_m2m, hf_tlv, array_length(hf_tlv));
- proto_register_subtree_array(ett, array_length(ett));
- }
- prefs_register_protocol(proto_m2m, proto_reg_handoff_m2m);
+ proto_m2m = proto_register_protocol (
+ "WiMax Mac to Mac Packet", /* name */
+ "M2M (m2m)", /* short name */
+ "m2m" /* abbrev */
+ );
+
+ proto_register_field_array(proto_m2m, hf, array_length(hf));
+ proto_register_field_array(proto_m2m, hf_tlv, array_length(hf_tlv));
+ proto_register_subtree_array(ett, array_length(ett));
/* init the PDU fragment table */
fragment_table_init(&pdu_frag_table);
diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c
index 55a2b472d5..0742b5137e 100644
--- a/plugins/opcua/opcua.c
+++ b/plugins/opcua/opcua.c
@@ -27,9 +27,7 @@
#include <glib.h>
#include <epan/packet.h>
-#include <epan/emem.h>
#include <epan/dissectors/packet-tcp.h>
-#include <epan/prefs.h>
#include "opcua_transport_layer.h"
#include "opcua_security_layer.h"
#include "opcua_application_layer.h"
@@ -40,8 +38,6 @@
#include "opcua_hfindeces.h"
/* forward reference */
-void proto_register_opcua (void);
-void proto_reg_handoff_opcua (void);
static void dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -50,8 +46,7 @@ typedef void (*FctParse)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset);
static int proto_opcua = -1;
/** Official IANA registered port for OPC UA Binary Protocol. */
-static int global_opcua_port = 4840;
-static dissector_handle_t opcua_handle;
+#define OPCUA_PORT 4840
/** subtree types */
gint ett_opcua_transport = -1;
@@ -100,18 +95,11 @@ static gint *ett[] =
*/
void proto_register_opcua(void)
{
- module_t *opcua_module;
-
- if (proto_opcua == -1)
- {
- proto_opcua = proto_register_protocol(
- "OpcUa Binary Protocol", /* name */
- "OpcUa", /* short name */
- "opcua" /* abbrev */
- );
- }
- opcua_module = prefs_register_protocol(proto_opcua, proto_reg_handoff_opcua);
-
+ proto_opcua = proto_register_protocol(
+ "OpcUa Binary Protocol", /* name */
+ "OpcUa", /* short name */
+ "opcua" /* abbrev */
+ );
registerTransportLayerTypes(proto_opcua);
registerSecurityLayerTypes(proto_opcua);
registerApplicationLayerTypes(proto_opcua);
@@ -129,13 +117,9 @@ void proto_register_opcua(void)
*/
void proto_reg_handoff_opcua(void)
{
- static int Initialized=FALSE;
-
- if (!Initialized)
- {
- opcua_handle = create_dissector_handle(dissect_opcua, proto_opcua);
- dissector_add("tcp.port", global_opcua_port, opcua_handle);
- }
+ dissector_handle_t opcua_handle;
+ opcua_handle = create_dissector_handle(dissect_opcua, proto_opcua);
+ dissector_add("tcp.port", OPCUA_PORT, opcua_handle);
}
/** header length that is needed to compute
diff --git a/plugins/pcli/packet-pcli.c b/plugins/pcli/packet-pcli.c
index 2ea26b07b9..a957ac5669 100644
--- a/plugins/pcli/packet-pcli.c
+++ b/plugins/pcli/packet-pcli.c
@@ -69,7 +69,6 @@ static int ett_pcli = -1;
*/
static guint global_udp_port_pcli = UDP_PORT_PCLI;
-static guint udp_port_pcli = UDP_PORT_PCLI;
/* A static handle for the ip dissector */
static dissector_handle_t ip_handle;
@@ -147,13 +146,13 @@ proto_register_pcli(void) {
void
proto_reg_handoff_pcli(void) {
- static int pcli_initialized = FALSE;
+ static gboolean pcli_initialized = FALSE;
static dissector_handle_t pcli_handle;
-
- ip_handle = find_dissector("ip");
+ static guint udp_port_pcli;
if(!pcli_initialized) {
pcli_handle = create_dissector_handle(dissect_pcli,proto_pcli);
+ ip_handle = find_dissector("ip");
pcli_initialized = TRUE;
} else {
dissector_delete("udp.port",udp_port_pcli,pcli_handle);
diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c
index 4ee1237fa8..f9a7432829 100644
--- a/plugins/profinet/packet-pn-rt.c
+++ b/plugins/profinet/packet-pn-rt.c
@@ -51,10 +51,6 @@
#include "packet-pn.h"
-
-
-void proto_reg_handoff_pn_rt(void);
-
/* Define the pn-rt proto */
static int proto_pn_rt = -1;
@@ -418,7 +414,7 @@ proto_register_pn_rt(void)
/* Register our configuration options */
- pn_rt_module = prefs_register_protocol(proto_pn_rt, proto_reg_handoff_pn_rt);
+ pn_rt_module = prefs_register_protocol(proto_pn_rt, NULL);
prefs_register_bool_preference(pn_rt_module, "summary_in_tree",
"Show PN-RT summary in protocol tree",
@@ -432,23 +428,13 @@ proto_register_pn_rt(void)
}
-/* The registration hand-off routine
- * Is called at startup, and everytime the preferences of this protocol changed. */
+/* The registration hand-off routine is called at startup */
void
proto_reg_handoff_pn_rt(void)
{
- static int pn_rt_prefs_initialized = FALSE;
- static dissector_handle_t pn_rt_handle;
+ dissector_handle_t pn_rt_handle;
-
- if (!pn_rt_prefs_initialized) {
- pn_rt_handle = create_dissector_handle(dissect_pn_rt, proto_pn_rt);
- pn_rt_prefs_initialized = TRUE;
- }
- else {
- dissector_delete("ethertype", ETHERTYPE_PROFINET, pn_rt_handle);
- dissector_delete("udp.port", 0x8892, pn_rt_handle);
- }
+ pn_rt_handle = create_dissector_handle(dissect_pn_rt, proto_pn_rt);
dissector_add("ethertype", ETHERTYPE_PROFINET, pn_rt_handle);
dissector_add("udp.port", 0x8892, pn_rt_handle);
diff --git a/plugins/rtnet/packet-rtnet.c b/plugins/rtnet/packet-rtnet.c
index b5b457672b..a485229287 100644
--- a/plugins/rtnet/packet-rtnet.c
+++ b/plugins/rtnet/packet-rtnet.c
@@ -129,11 +129,8 @@ static const value_string tdma_msg_vals[] = {
{ 0, NULL }
};
-static dissector_table_t ethertype_table = NULL;
-static dissector_handle_t data_handle = NULL;
-
-void proto_reg_handoff_rtmac(void);
-void proto_reg_handoff_rtcfg(void);
+static dissector_table_t ethertype_table;
+static dissector_handle_t data_handle;
/* Define the rtnet proto */
static int proto_rtmac = -1;
@@ -1357,34 +1354,18 @@ proto_register_rtcfg(void) {
void
proto_reg_handoff_rtmac(void) {
- static int rtmac_initialized = FALSE;
- static dissector_handle_t rtmac_handle;
-
- if( !rtmac_initialized ){
- rtmac_handle = create_dissector_handle(dissect_rtmac, proto_rtmac);
- rtmac_initialized = TRUE;
- } else {
- dissector_delete("ethertype",ETHERTYPE_RTMAC, rtmac_handle);
- }
+ dissector_handle_t rtmac_handle;
+ rtmac_handle = create_dissector_handle(dissect_rtmac, proto_rtmac);
dissector_add("ethertype", ETHERTYPE_RTMAC, rtmac_handle);
-
-
ethertype_table = find_dissector_table("ethertype");
}
void
proto_reg_handoff_rtcfg(void) {
- static int rtcfg_initialized = FALSE;
- static dissector_handle_t rtcfg_handle;
-
- if( !rtcfg_initialized ){
- data_handle = find_dissector("data");
- rtcfg_handle = create_dissector_handle(dissect_rtcfg, proto_rtcfg);
- rtcfg_initialized = TRUE;
- } else {
- dissector_delete("ethertype",ETHERTYPE_RTCFG, rtcfg_handle);
- }
+ dissector_handle_t rtcfg_handle;
+ data_handle = find_dissector("data");
+ rtcfg_handle = create_dissector_handle(dissect_rtcfg, proto_rtcfg);
dissector_add("ethertype", ETHERTYPE_RTCFG, rtcfg_handle);
}
diff --git a/plugins/sbus/packet-sbus.c b/plugins/sbus/packet-sbus.c
index 4865321f64..63ef37e9b7 100644
--- a/plugins/sbus/packet-sbus.c
+++ b/plugins/sbus/packet-sbus.c
@@ -176,9 +176,6 @@
#define F_INFO_B2 (1<<4) /* EEPROM information of slot B2*/
#define F_PGU_BAUD (1<<5) /* PGU baudrate can be switched*/
-/* Forward declaration we need below */
-void proto_reg_handoff_sbus(void);
-
/* Initialize the protocol and registered fields */
static int proto_sbus = -1;
static int hf_sbus_length = -1;
diff --git a/plugins/sercosiii/packet-sercosiii_1v1.c b/plugins/sercosiii/packet-sercosiii_1v1.c
index ddbce53e12..8c65ecf920 100644
--- a/plugins/sercosiii/packet-sercosiii_1v1.c
+++ b/plugins/sercosiii/packet-sercosiii_1v1.c
@@ -37,11 +37,6 @@
#include "packet-sercosiii.h"
-static int global_siii_eth_type = ETHERTYPE_SERCOS;
-
-/* Forward declaration we need below */
-void proto_reg_handoff_sercosiii(void);
-
/* Initialize the protocol and registered fields */
static gint proto_siii = -1;
@@ -125,14 +120,8 @@ proto_register_sercosiii(void)
void
proto_reg_handoff_sercosiii(void)
{
- static gboolean inited = FALSE;
-
- if( !inited ) {
+ dissector_handle_t siii_handle;
- dissector_handle_t siii_handle;
-
- siii_handle = create_dissector_handle(dissect_siii, proto_siii);
- dissector_add("ethertype", global_siii_eth_type, siii_handle);
- inited = TRUE;
- }
+ siii_handle = create_dissector_handle(dissect_siii, proto_siii);
+ dissector_add("ethertype", ETHERTYPE_SERCOS, siii_handle);
}