diff options
author | Michael Mann <mmann78@netscape.net> | 2017-01-28 19:53:36 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-01-29 13:29:04 +0000 |
commit | af54b292e60fcdd8d03ec583e2b46c9c51f259a5 (patch) | |
tree | 67a4b61fd3e71ada67f2c27092a6849424759263 /plugins | |
parent | ed8ac81497c890bc82f161be727c0bb5285dcf12 (diff) |
Register reassembly tables
Register all reassembly tables with a central unit, allowing the
central unit to have the callback that initializes and destroys
the reassembly tables, rather than have dissectors do it individually.
Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4
Reviewed-on: https://code.wireshark.org/review/19834
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/docsis/packet-docsis.c | 16 | ||||
-rw-r--r-- | plugins/m2m/packet-m2m.c | 20 | ||||
-rw-r--r-- | plugins/opcua/opcua.c | 17 | ||||
-rw-r--r-- | plugins/profinet/packet-pn-rt.c | 5 | ||||
-rw-r--r-- | plugins/wimax/mac_hd_generic_decoder.c | 6 |
5 files changed, 11 insertions, 53 deletions
diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index 01f44c384b..bc17b6eeb5 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -264,18 +264,6 @@ static guint16 frag_sid; */ static reassembly_table docsis_reassembly_table; -static void -docsis_defragment_init(void) -{ - reassembly_table_init(&docsis_reassembly_table, - &addresses_reassembly_table_functions); -} - -static void -docsis_defragment_cleanup(void) -{ - reassembly_table_destroy(&docsis_reassembly_table); -} static const fragment_items docsis_frag_items = { &ett_docsis_fragment, @@ -1158,8 +1146,8 @@ proto_register_docsis (void) #endif docsis_handle = register_dissector ("docsis", dissect_docsis, proto_docsis); - register_init_routine(docsis_defragment_init); - register_cleanup_routine(docsis_defragment_cleanup); + reassembly_table_register(&docsis_reassembly_table, + &addresses_reassembly_table_functions); } void diff --git a/plugins/m2m/packet-m2m.c b/plugins/m2m/packet-m2m.c index 022b4f537a..2c7b5c0fc1 100644 --- a/plugins/m2m/packet-m2m.c +++ b/plugins/m2m/packet-m2m.c @@ -155,20 +155,6 @@ static gint hf_m2m_phy_attributes = -1; static expert_field ei_m2m_unexpected_length = EI_INIT; -/* Register M2M defrag table init routine. */ -static void -m2m_defragment_init(void) -{ - reassembly_table_init(&pdu_reassembly_table, - &addresses_reassembly_table_functions); -} - -static void -m2m_defragment_cleanup(void) -{ - reassembly_table_destroy(&pdu_reassembly_table); -} - /* WiMax MAC to MAC protocol dissector */ static int dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -799,9 +785,9 @@ void proto_register_m2m(void) expert_m2m = expert_register_protocol(proto_m2m); expert_register_field_array(expert_m2m, ei, array_length(ei)); - /* Register the PDU fragment table init routine */ - register_init_routine(m2m_defragment_init); - register_cleanup_routine(m2m_defragment_cleanup); + /* Register reassembly table */ + reassembly_table_register(&pdu_reassembly_table, + &addresses_reassembly_table_functions); } /* Register Wimax Mac to Mac Protocol handler */ diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c index 1341b96882..08f1051704 100644 --- a/plugins/opcua/opcua.c +++ b/plugins/opcua/opcua.c @@ -355,19 +355,6 @@ static int dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo return tvb_reported_length(tvb); } -static void -init_opcua(void) -{ - reassembly_table_init(&opcua_reassembly_table, - &addresses_reassembly_table_functions); -} - -static void -cleanup_opcua(void) -{ - reassembly_table_destroy(&opcua_reassembly_table); -} - /** plugin entry functions. * This registers the OpcUa protocol. */ @@ -412,8 +399,8 @@ void proto_register_opcua(void) proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_opcua, hf, array_length(hf)); - register_init_routine(&init_opcua); - register_cleanup_routine(&cleanup_opcua); + reassembly_table_register(&opcua_reassembly_table, + &addresses_reassembly_table_functions); } void proto_reg_handoff_opcua(void) diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c index 6ee55eb67c..2bee4619b0 100644 --- a/plugins/profinet/packet-pn-rt.c +++ b/plugins/profinet/packet-pn-rt.c @@ -353,8 +353,6 @@ pnio_defragment_init(void) guint32 i; for (i=0; i < 16; i++) /* init the reasemble help array */ start_frag_OR_ID[i] = 0; - reassembly_table_init(&pdu_reassembly_table, - &addresses_reassembly_table_functions); reasembled_frag_table = g_hash_table_new(NULL, NULL); } @@ -362,7 +360,6 @@ static void pnio_defragment_cleanup(void) { g_hash_table_destroy(reasembled_frag_table); - reassembly_table_destroy(&pdu_reassembly_table); } /* possibly dissect a FRAG_PDU related PN-RT packet */ @@ -991,6 +988,8 @@ proto_register_pn_rt(void) init_pn (proto_pn_rt); register_init_routine(pnio_defragment_init); register_cleanup_routine(pnio_defragment_cleanup); + reassembly_table_register(&pdu_reassembly_table, + &addresses_reassembly_table_functions); } diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index 04e2c82eaf..2f5a7f9b92 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -612,9 +612,6 @@ static void wimax_defragment_init(void) { gint i; - reassembly_table_init(&payload_reassembly_table, - &addresses_reassembly_table_functions); - /* Init fragmentation variables. */ for (i = 0; i < MAX_CID; i++) { @@ -636,7 +633,6 @@ static void wimax_defragment_init(void) static void wimax_defragment_cleanup(void) { - reassembly_table_destroy(&payload_reassembly_table); g_free(cid_adj_array); cid_adj_array = NULL; g_free(frag_num_array); @@ -2291,6 +2287,8 @@ void proto_register_mac_header_generic(void) /* Register the payload fragment table init routine */ register_init_routine(wimax_defragment_init); register_cleanup_routine(wimax_defragment_cleanup); + reassembly_table_register(&payload_reassembly_table, + &addresses_reassembly_table_functions); } void |