From 9365fd3d3a4cdac07d70bd77f7a42f3260b33b5e Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 28 Jan 2017 22:29:32 -0500 Subject: Convert GHashTable -> wmem_map_t for ASN.1 disseectors Change-Id: Id749c41947c6300f2c82ed947352c336f9e45b72 Reviewed-on: https://code.wireshark.org/review/19838 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-h225.c | 54 +++++++++++-------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) (limited to 'epan/dissectors/packet-h225.c') diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index f15a790c2c..bcbf8e2255 100644 --- a/epan/dissectors/packet-h225.c +++ b/epan/dissectors/packet-h225.c @@ -71,7 +71,6 @@ void proto_register_h225(void); static h225_packet_info* create_h225_packet_info(packet_info *pinfo); -static void h225_init_routine(void); static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, h225_packet_info *pi); /* Item of ras request list*/ @@ -94,7 +93,7 @@ typedef struct _h225ras_call_info_key { /* Global Memory Chunks for lists and Global hash tables*/ -static GHashTable *ras_calls[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static wmem_map_t *ras_calls[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; /* functions, needed using ras-request and halfcall matching*/ static h225ras_call_t * find_h225ras_call(h225ras_call_info_key *h225ras_call_key ,int category); @@ -909,7 +908,7 @@ static int hf_h225_stopped = -1; /* NULL */ static int hf_h225_notAvailable = -1; /* NULL */ /*--- End of included file: packet-h225-hf.c ---*/ -#line 129 "./asn1/h225/packet-h225-template.c" +#line 128 "./asn1/h225/packet-h225-template.c" /* Initialize the subtree pointers */ static gint ett_h225 = -1; @@ -1157,7 +1156,7 @@ static gint ett_h225_ServiceControlResponse = -1; static gint ett_h225_T_result = -1; /*--- End of included file: packet-h225-ett.c ---*/ -#line 133 "./asn1/h225/packet-h225-template.c" +#line 132 "./asn1/h225/packet-h225-template.c" /* Preferences */ static guint h225_tls_port = TLS_PORT_CS; @@ -7824,7 +7823,7 @@ static int dissect_RasMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-h225-fn.c ---*/ -#line 249 "./asn1/h225/packet-h225-template.c" +#line 248 "./asn1/h225/packet-h225-template.c" /* Forward declaration we need below */ void proto_reg_handoff_h225(void); @@ -7854,8 +7853,7 @@ static guint h225ras_call_hash(gconstpointer k) h225ras_call_t * find_h225ras_call(h225ras_call_info_key *h225ras_call_key ,int category) { - h225ras_call_t *h225ras_call = NULL; - h225ras_call = (h225ras_call_t *)g_hash_table_lookup(ras_calls[category], h225ras_call_key); + h225ras_call_t *h225ras_call = (h225ras_call_t *)wmem_map_lookup(ras_calls[category], h225ras_call_key); return h225ras_call; } @@ -7883,7 +7881,7 @@ h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packe h225ras_call->req_time=pinfo->abs_ts; h225ras_call->guid=*guid; /* store it */ - g_hash_table_insert(ras_calls[category], new_h225ras_call_key, h225ras_call); + wmem_map_insert(ras_calls[category], new_h225ras_call_key, h225ras_call); return h225ras_call; } @@ -7910,34 +7908,6 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin return h225ras_call; } -/* Init routine for hash tables and delay calculation - This routine will be called by Wireshark, before it - is (re-)dissecting a trace file from beginning. - We need to discard and init any state we've saved */ - -static void -h225_init_routine(void) -{ - int i; - /* create new hash-tables for RAS SRT */ - - for(i=0;i<7;i++) { - ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal); - } - -} - -static void -h225_cleanup_routine(void) -{ - int i; - - /* free hash-tables for RAS SRT */ - for(i=0;i<7;i++) { - g_hash_table_destroy(ras_calls[i]); - } -} - static int dissect_h225_H323UserInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -11506,7 +11476,7 @@ void proto_register_h225(void) { NULL, HFILL }}, /*--- End of included file: packet-h225-hfarr.c ---*/ -#line 842 "./asn1/h225/packet-h225-template.c" +#line 812 "./asn1/h225/packet-h225-template.c" }; /* List of subtrees */ @@ -11756,7 +11726,7 @@ void proto_register_h225(void) { &ett_h225_T_result, /*--- End of included file: packet-h225-ettarr.c ---*/ -#line 848 "./asn1/h225/packet-h225-template.c" +#line 818 "./asn1/h225/packet-h225-template.c" }; static tap_param h225_stat_params[] = { @@ -11780,7 +11750,7 @@ void proto_register_h225(void) { }; module_t *h225_module; - int proto_h225_ras; + int i, proto_h225_ras; /* Register protocol */ proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -11821,8 +11791,10 @@ void proto_register_h225(void) { gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", proto_h225, FT_STRING, BASE_NONE); gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", proto_h225, FT_STRING, BASE_NONE); - register_init_routine(&h225_init_routine); - register_cleanup_routine(&h225_cleanup_routine); + for(i=0;i<7;i++) { + ras_calls[i] = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), h225ras_call_hash, h225ras_call_equal); + } + h225_tap = register_tap(PFNAME); register_rtd_table(proto_h225_ras, PFNAME, NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL); -- cgit v1.2.1