aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/h225/packet-h225-template.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-28 22:29:32 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-30 02:25:24 +0000
commit9365fd3d3a4cdac07d70bd77f7a42f3260b33b5e (patch)
tree934046830769d5f32b51cabd240e3ed40e07a217 /epan/dissectors/asn1/h225/packet-h225-template.c
parent984d78da13608b7cba3cd8144d1285b33277b0d3 (diff)
Convert GHashTable -> wmem_map_t for ASN.1 disseectors
Change-Id: Id749c41947c6300f2c82ed947352c336f9e45b72 Reviewed-on: https://code.wireshark.org/review/19838 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 'epan/dissectors/asn1/h225/packet-h225-template.c')
-rw-r--r--epan/dissectors/asn1/h225/packet-h225-template.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/epan/dissectors/asn1/h225/packet-h225-template.c b/epan/dissectors/asn1/h225/packet-h225-template.c
index c037ed3d5c..8b859e3f6c 100644
--- a/epan/dissectors/asn1/h225/packet-h225-template.c
+++ b/epan/dissectors/asn1/h225/packet-h225-template.c
@@ -63,7 +63,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*/
@@ -86,7 +85,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);
@@ -275,8 +274,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;
}
@@ -304,7 +302,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;
}
@@ -331,34 +329,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_)
{
@@ -868,7 +838,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);
@@ -909,8 +879,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);