aboutsummaryrefslogtreecommitdiffstats
path: root/epan
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
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')
-rw-r--r--epan/dissectors/asn1/acse/packet-acse-template.c27
-rw-r--r--epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c24
-rw-r--r--epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c24
-rw-r--r--epan/dissectors/asn1/camel/packet-camel-template.c24
-rw-r--r--epan/dissectors/asn1/h225/packet-h225-template.c44
-rw-r--r--epan/dissectors/asn1/h245/h245.cnf10
-rw-r--r--epan/dissectors/asn1/h245/packet-h245-template.c32
-rw-r--r--epan/dissectors/asn1/lte-rrc/lte-rrc.cnf12
-rw-r--r--epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c22
-rw-r--r--epan/dissectors/asn1/pres/packet-pres-template.c27
-rw-r--r--epan/dissectors/asn1/ros/packet-ros-template.c79
-rw-r--r--epan/dissectors/asn1/rtse/packet-rtse-template.c7
-rw-r--r--epan/dissectors/packet-acse.c33
-rw-r--r--epan/dissectors/packet-ansi_map.c30
-rw-r--r--epan/dissectors/packet-ansi_tcap.c30
-rw-r--r--epan/dissectors/packet-camel.c30
-rw-r--r--epan/dissectors/packet-h225.c54
-rw-r--r--epan/dissectors/packet-h245.c52
-rw-r--r--epan/dissectors/packet-lte-rrc.c40
-rw-r--r--epan/dissectors/packet-pres.c33
-rw-r--r--epan/dissectors/packet-ros.c89
-rw-r--r--epan/dissectors/packet-rtse.c13
22 files changed, 220 insertions, 516 deletions
diff --git a/epan/dissectors/asn1/acse/packet-acse-template.c b/epan/dissectors/asn1/acse/packet-acse-template.c
index f783b87061..02adb4e98e 100644
--- a/epan/dissectors/asn1/acse/packet-acse-template.c
+++ b/epan/dissectors/asn1/acse/packet-acse-template.c
@@ -90,7 +90,7 @@ typedef struct _acse_ctx_oid_t {
guint32 ctx_id;
char *oid;
} acse_ctx_oid_t;
-static GHashTable *acse_ctx_oid_table = NULL;
+static wmem_map_t *acse_ctx_oid_table = NULL;
static guint
acse_ctx_oid_hash(gconstpointer k)
@@ -108,18 +108,6 @@ acse_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-acse_init(void)
-{
- if (acse_ctx_oid_table) {
- g_hash_table_destroy(acse_ctx_oid_table);
- acse_ctx_oid_table = NULL;
- }
- acse_ctx_oid_table = g_hash_table_new(acse_ctx_oid_hash,
- acse_ctx_oid_equal);
-
-}
-
-static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
@@ -128,18 +116,18 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
aco->oid=wmem_strdup(wmem_file_scope(), oid);
/* if this ctx already exists, remove the old one first */
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, aco);
if (tmpaco) {
- g_hash_table_remove(acse_ctx_oid_table, tmpaco);
+ wmem_map_remove(acse_ctx_oid_table, tmpaco);
}
- g_hash_table_insert(acse_ctx_oid_table, aco, aco);
+ wmem_map_insert(acse_ctx_oid_table, aco, aco);
}
static char *
find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
{
acse_ctx_oid_t aco, *tmpaco;
aco.ctx_id=idx;
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, &aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, &aco);
if (tmpaco) {
return tmpaco->oid;
}
@@ -294,6 +282,11 @@ void proto_register_acse(void) {
proto_register_subtree_array(ett, array_length(ett));
expert_acse = expert_register_protocol(proto_acse);
expert_register_field_array(expert_acse, ei, array_length(ei));
+
+#if NOT_NEEDED
+ acse_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), acse_ctx_oid_hash,
+ acse_ctx_oid_equal);
+#endif
}
diff --git a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c
index 09947f8c31..67f43eae93 100644
--- a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c
+++ b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c
@@ -387,20 +387,7 @@ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo
/* Transaction table */
-static GHashTable *TransactionId_table=NULL;
-
-static void
-ansi_map_init(void)
-{
- TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void
-ansi_map_cleanup(void)
-{
- /* Destroy any existing memory chunks / hashes. */
- g_hash_table_destroy(TransactionId_table);
-}
+static wmem_map_t *TransactionId_table=NULL;
/* Store Invoke information needed for the corresponding reply */
static void
@@ -432,7 +419,7 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
break;
}
/* If the entry allready exists don't owervrite it */
- ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)g_hash_table_lookup(TransactionId_table,buf);
+ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table,buf);
if(ansi_map_saved_invokedata)
return;
@@ -440,7 +427,7 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
ansi_map_saved_invokedata->opcode = p_private_tcap->d.OperationCode_private;
ansi_map_saved_invokedata->ServiceIndicator = ServiceIndicator;
- g_hash_table_insert(TransactionId_table,
+ wmem_map_insert(TransactionId_table,
wmem_strdup(wmem_file_scope(), buf),
ansi_map_saved_invokedata);
@@ -4363,7 +4350,7 @@ find_saved_invokedata(asn1_ctx_t *actx, struct ansi_tcap_private_t *p_private_tc
}
/*g_warning("Find Hash string %s pkt: %u",buf,actx->pinfo->num);*/
- ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
+ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table, buf);
if(ansi_map_saved_invokedata){
OperationCode = ansi_map_saved_invokedata->opcode & 0xff;
ServiceIndicator = ansi_map_saved_invokedata->ServiceIndicator;
@@ -5499,8 +5486,7 @@ void proto_register_ansi_map(void) {
"Type of matching invoke/response, risk of mismatch if loose matching chosen",
&ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
- register_init_routine(&ansi_map_init);
- register_cleanup_routine(&ansi_map_cleanup);
+ TransactionId_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
register_stat_tap_table_ui(&stat_table);
}
diff --git a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c
index 7721b91305..4d65674aa4 100644
--- a/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c
+++ b/epan/dissectors/asn1/ansi_tcap/packet-ansi_tcap-template.c
@@ -146,20 +146,7 @@ struct ansi_tcap_invokedata_t {
gint32 OperationCode_national;
};
-static GHashTable *TransactionId_table=NULL;
-
-static void
-ansi_tcap_init(void)
-{
- TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void
-ansi_tcap_cleanup(void)
-{
- /* Destroy any existing memory chunks / hashes. */
- g_hash_table_destroy(TransactionId_table);
-}
+static wmem_map_t *TransactionId_table=NULL;
/* Store Invoke information needed for the corresponding reply */
static void
@@ -189,7 +176,7 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
}
/* If the entry allready exists don't owervrite it */
- ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table,buf);
+ ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)wmem_map_lookup(TransactionId_table,buf);
if(ansi_tcap_saved_invokedata)
return;
@@ -198,7 +185,7 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
ansi_tcap_saved_invokedata->OperationCode_national = ansi_tcap_private.d.OperationCode_national;
ansi_tcap_saved_invokedata->OperationCode_private = ansi_tcap_private.d.OperationCode_private;
- g_hash_table_insert(TransactionId_table,
+ wmem_map_insert(TransactionId_table,
wmem_strdup(wmem_file_scope(), buf),
ansi_tcap_saved_invokedata);
/*
@@ -237,7 +224,7 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
break;
}
- ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
+ ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)wmem_map_lookup(TransactionId_table, buf);
if(ansi_tcap_saved_invokedata){
ansi_tcap_private.d.OperationCode = ansi_tcap_saved_invokedata->OperationCode;
ansi_tcap_private.d.OperationCode_national = ansi_tcap_saved_invokedata->OperationCode_national;
@@ -508,6 +495,5 @@ proto_register_ansi_tcap(void)
"Type of matching invoke/response, risk of mismatch if loose matching chosen",
&ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
- register_init_routine(&ansi_tcap_init);
- register_cleanup_routine(&ansi_tcap_cleanup);
+ TransactionId_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
}
diff --git a/epan/dissectors/asn1/camel/packet-camel-template.c b/epan/dissectors/asn1/camel/packet-camel-template.c
index 78df8f9bc3..bc463d59e7 100644
--- a/epan/dissectors/asn1/camel/packet-camel-template.c
+++ b/epan/dissectors/asn1/camel/packet-camel-template.c
@@ -165,7 +165,7 @@ const char *camel_obj_id = NULL;
gboolean is_ExtensionField =FALSE;
/* Global hash tables*/
-static GHashTable *srt_calls = NULL;
+static wmem_map_t *srt_calls = NULL;
static guint32 camelsrt_global_SessionId=1;
static int camel_opcode_type;
@@ -441,7 +441,7 @@ static struct camelsrt_call_t *
find_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
{
struct camelsrt_call_t *p_camelsrt_call = NULL;
- p_camelsrt_call = (struct camelsrt_call_t *)g_hash_table_lookup(srt_calls, p_camelsrt_call_key);
+ p_camelsrt_call = (struct camelsrt_call_t *)wmem_map_lookup(srt_calls, p_camelsrt_call_key);
#ifdef DEBUG_CAMELSRT
if(p_camelsrt_call) {
@@ -486,7 +486,7 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
dbg(10,"D%d ", p_new_camelsrt_call->session_id);
#endif
/* store it */
- g_hash_table_insert(srt_calls, p_new_camelsrt_call_key, p_new_camelsrt_call);
+ wmem_map_insert(srt_calls, p_new_camelsrt_call_key, p_new_camelsrt_call);
return p_new_camelsrt_call;
}
@@ -497,8 +497,6 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
static void
camelsrt_init_routine(void)
{
- /* create new hash-table for SRT */
- srt_calls = g_hash_table_new(camelsrt_call_hash, camelsrt_call_equal);
/* Reset the session counter */
camelsrt_global_SessionId=1;
@@ -509,13 +507,6 @@ camelsrt_init_routine(void)
gcamel_DisplaySRT=gcamel_PersistentSRT || gcamel_HandleSRT&gcamel_StatSRT;
}
-static void
-camelsrt_cleanup_routine(void)
-{
- /* free hash-table for SRT */
- g_hash_table_destroy(srt_calls);
-}
-
/*
* Update a record with the data of the Request
@@ -566,7 +557,7 @@ camelsrt_close_call_matching(packet_info *pinfo,
p_camelsrt_info->msginfo[CAMELSRT_SESSION].req_time = p_camelsrt_call->category[CAMELSRT_SESSION].req_time;
if ( !gcamel_PersistentSRT ) {
- g_hash_table_remove(srt_calls, &camelsrt_call_key);
+ wmem_map_remove(srt_calls, &camelsrt_call_key);
#ifdef DEBUG_CAMELSRT
dbg(20,"remove hash ");
#endif
@@ -629,7 +620,7 @@ camelsrt_begin_call_matching(packet_info *pinfo,
dbg(10,"\n Session begin #%u\n", pinfo->num);
dbg(11,"Search key %lu ",camelsrt_call_key.SessionIdKey);
#endif
- p_camelsrt_call = (struct camelsrt_call_t *)g_hash_table_lookup(srt_calls, &camelsrt_call_key);
+ p_camelsrt_call = (struct camelsrt_call_t *)wmem_map_lookup(srt_calls, &camelsrt_call_key);
if (p_camelsrt_call) {
/* We have seen this request before -> do nothing */
#ifdef DEBUG_CAMELSRT
@@ -1598,7 +1589,10 @@ void proto_register_camel(void) {
/* Routine for statistic */
register_init_routine(&camelsrt_init_routine);
- register_cleanup_routine(&camelsrt_cleanup_routine);
+
+ /* create new hash-table for SRT */
+ srt_calls = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), camelsrt_call_hash, camelsrt_call_equal);
+
camel_tap=register_tap(PSNAME);
register_srt_table(proto_camel, PSNAME, 1, camelstat_packet, camelstat_init, NULL);
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);
diff --git a/epan/dissectors/asn1/h245/h245.cnf b/epan/dissectors/asn1/h245/h245.cnf
index 1d8f3e4595..24b870734b 100644
--- a/epan/dissectors/asn1/h245/h245.cnf
+++ b/epan/dissectors/asn1/h245/h245.cnf
@@ -141,14 +141,14 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
pending->rev_channel_params = h223_rev_lc_params;
temp = h223_fw_lc_num;
if (%(ACTX)s->pinfo->p2p_dir > -1)
- g_hash_table_insert(h223_pending_olc_reqs[%(ACTX)s->pinfo->p2p_dir], GINT_TO_POINTER(temp), pending);
+ wmem_map_insert(h223_pending_olc_reqs[%(ACTX)s->pinfo->p2p_dir], GINT_TO_POINTER(temp), pending);
}
if (upcoming_olc) {
if (fast_start) {
h245_setup_channels(actx->pinfo, &upcoming_olc->rev_lc);
} else {
- g_hash_table_insert(h245_pending_olc_reqs,
+ wmem_map_insert(h245_pending_olc_reqs,
wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->dst, &%(ACTX)s->pinfo->src)),
upcoming_olc);
}
@@ -235,7 +235,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
%(ACTX)s->pinfo->p2p_dir = P2P_DIR_RECV;
else
%(ACTX)s->pinfo->p2p_dir = P2P_DIR_SENT;
- pend = (h223_pending_olc *)g_hash_table_lookup( h223_pending_olc_reqs[%(ACTX)s->pinfo->p2p_dir], GINT_TO_POINTER(temp) );
+ pend = (h223_pending_olc *)wmem_map_lookup( h223_pending_olc_reqs[%(ACTX)s->pinfo->p2p_dir], GINT_TO_POINTER(temp) );
if (pend) {
DISSECTOR_ASSERT( ( h223_rev_lc_num && pend->rev_channel_params)
|| (!h223_rev_lc_num && !pend->rev_channel_params) );
@@ -251,7 +251,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
if (upcoming_olc) {
olc_key = gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->src, &%(ACTX)s->pinfo->dst);
- olc_req = (olc_info_t *)g_hash_table_lookup(h245_pending_olc_reqs, olc_key);
+ olc_req = (olc_info_t *)wmem_map_lookup(h245_pending_olc_reqs, olc_key);
if (olc_req) {
update_unicast_addr(&olc_req->fwd_lc.media_addr, &upcoming_olc->fwd_lc.media_addr);
update_unicast_addr(&olc_req->fwd_lc.media_control_addr, &upcoming_olc->fwd_lc.media_control_addr);
@@ -259,7 +259,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
update_unicast_addr(&olc_req->rev_lc.media_control_addr, &upcoming_olc->rev_lc.media_control_addr);
h245_setup_channels(actx->pinfo, &olc_req->fwd_lc);
h245_setup_channels(actx->pinfo, &olc_req->rev_lc);
- g_hash_table_remove(h245_pending_olc_reqs, olc_key);
+ wmem_map_remove(h245_pending_olc_reqs, olc_key);
} else {
h245_setup_channels(actx->pinfo, &upcoming_olc->fwd_lc);
}
diff --git a/epan/dissectors/asn1/h245/packet-h245-template.c b/epan/dissectors/asn1/h245/packet-h245-template.c
index 801b9d1126..573ff89b7b 100644
--- a/epan/dissectors/asn1/h245/packet-h245-template.c
+++ b/epan/dissectors/asn1/h245/packet-h245-template.c
@@ -232,7 +232,7 @@ typedef struct _olc_info_t {
channel_info_t rev_lc;
} olc_info_t;
-static GHashTable* h245_pending_olc_reqs = NULL;
+static wmem_map_t* h245_pending_olc_reqs = NULL;
static gboolean fast_start = FALSE;
static olc_info_t *upcoming_olc = NULL;
static channel_info_t *upcoming_channel = NULL;
@@ -281,7 +281,7 @@ typedef struct {
h223_lc_params *rev_channel_params;
} h223_pending_olc;
-static GHashTable* h223_pending_olc_reqs[] = { NULL, NULL };
+static wmem_map_t* h223_pending_olc_reqs[] = { NULL, NULL };
static dissector_handle_t h245_lc_dissector;
static guint16 h245_lc_temp;
static guint16 h223_fw_lc_num;
@@ -291,34 +291,13 @@ static h223_lc_params *h223_fw_lc_params;
static h223_lc_params *h223_rev_lc_params;
static h223_add_lc_handle_t h223_add_lc_handle = NULL;
-static void h223_lc_init_dir( int dir )
-{
- if ( h223_pending_olc_reqs[dir] )
- g_hash_table_destroy( h223_pending_olc_reqs[dir] );
- h223_pending_olc_reqs[dir] = g_hash_table_new( g_direct_hash, g_direct_equal );
-}
-
static void h223_lc_init( void )
{
- h223_lc_init_dir( P2P_DIR_SENT );
- h223_lc_init_dir( P2P_DIR_RECV );
h223_lc_params_temp = NULL;
h245_lc_dissector = NULL;
h223_fw_lc_num = 0;
}
-static void h245_init(void)
-{
- h245_pending_olc_reqs = g_hash_table_new(g_str_hash, g_str_equal);
-
- h223_lc_init();
-}
-
-static void h245_cleanup(void)
-{
- g_hash_table_destroy(h245_pending_olc_reqs);
-}
-
void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
{
h223_add_lc_handle = handle;
@@ -517,8 +496,11 @@ void proto_register_h245(void) {
/* Register protocol */
proto_h245 = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_init_routine(h245_init);
- register_cleanup_routine(h245_cleanup);
+ h223_pending_olc_reqs[P2P_DIR_SENT] = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal );
+ h223_pending_olc_reqs[P2P_DIR_RECV] = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal );
+ h245_pending_olc_reqs = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
+
+ register_init_routine(h223_lc_init);
/* Register fields and subtrees */
proto_register_field_array(proto_h245, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/asn1/lte-rrc/lte-rrc.cnf b/epan/dissectors/asn1/lte-rrc/lte-rrc.cnf
index b666535e6c..fd23e33bbd 100644
--- a/epan/dissectors/asn1/lte-rrc/lte-rrc.cnf
+++ b/epan/dissectors/asn1/lte-rrc/lte-rrc.cnf
@@ -748,7 +748,7 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
- g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
+ wmem_map_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
GUINT_TO_POINTER(dataCodingScheme));
}
@@ -769,7 +769,7 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB11 warning message",
frag_data, &lte_rrc_sib11_frag_items, NULL, subtree);
- p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
+ p_dcs = wmem_map_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
if (frag_tvb && p_dcs) {
dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
@@ -823,7 +823,7 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
- g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
+ wmem_map_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
GUINT_TO_POINTER(dataCodingScheme));
}
@@ -844,7 +844,7 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB12 warning message",
frag_data, &lte_rrc_sib12_frag_items, NULL, subtree);
- p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
+ p_dcs = wmem_map_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
if (frag_tvb && p_dcs) {
dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
@@ -1598,7 +1598,7 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(&lte_rrc_duration_val)
if (!actx->pinfo->fd->flags.visited) {
if (system_info_value_current_set && (value != system_info_value_current)) {
/* Add entry to the hash table. Offset by one to distinguish 0 from lookup failure */
- g_hash_table_insert(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num),
+ wmem_map_insert(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num),
GUINT_TO_POINTER(system_info_value_current+1));
}
system_info_value_current_set = TRUE;
@@ -1606,7 +1606,7 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(&lte_rrc_duration_val)
}
else {
/* Look up indication of changed info value from hash table */
- gpointer p_previous = g_hash_table_lookup(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num));
+ gpointer p_previous = wmem_map_lookup(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num));
if (p_previous != NULL) {
/* Subtract one from stored result to get previous value */
guint32 previous = GPOINTER_TO_UINT(p_previous) - 1;
diff --git a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
index cac4e6bcf2..62c101fc3e 100644
--- a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
+++ b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
@@ -65,10 +65,10 @@ static dissector_handle_t gsm_a_dtap_handle = NULL;
static dissector_handle_t gsm_rlcmac_dl_handle = NULL;
static dissector_handle_t lte_rrc_dl_ccch_handle;
-static GHashTable *lte_rrc_etws_cmas_dcs_hash = NULL;
+static wmem_map_t *lte_rrc_etws_cmas_dcs_hash = NULL;
/* Keep track of where/how the System Info value has changed */
-static GHashTable *lte_rrc_system_info_value_changed_hash = NULL;
+static wmem_map_t *lte_rrc_system_info_value_changed_hash = NULL;
static guint8 system_info_value_current;
static gboolean system_info_value_current_set;
@@ -3186,20 +3186,6 @@ dissect_lte_rrc_PCCH_NB(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
return tvb_captured_length(tvb);
}
-static void
-lte_rrc_init_protocol(void)
-{
- lte_rrc_etws_cmas_dcs_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
- lte_rrc_system_info_value_changed_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
-}
-
-static void
-lte_rrc_cleanup_protocol(void)
-{
- g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
- g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
-}
-
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_lte_rrc(void) {
@@ -4009,8 +3995,8 @@ void proto_register_lte_rrc(void) {
/* Register the dissectors defined in lte-rrc.conf */
#include "packet-lte-rrc-dis-reg.c"
- register_init_routine(&lte_rrc_init_protocol);
- register_cleanup_routine(&lte_rrc_cleanup_protocol);
+ lte_rrc_etws_cmas_dcs_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
+ lte_rrc_system_info_value_changed_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
reassembly_table_register(&lte_rrc_sib11_reassembly_table,
&addresses_reassembly_table_functions);
diff --git a/epan/dissectors/asn1/pres/packet-pres-template.c b/epan/dissectors/asn1/pres/packet-pres-template.c
index 54ac9ae26f..7ca8de50ae 100644
--- a/epan/dissectors/asn1/pres/packet-pres-template.c
+++ b/epan/dissectors/asn1/pres/packet-pres-template.c
@@ -69,7 +69,7 @@ typedef struct _pres_ctx_oid_t {
char *oid;
guint32 idx;
} pres_ctx_oid_t;
-static GHashTable *pres_ctx_oid_table = NULL;
+static wmem_map_t *pres_ctx_oid_table = NULL;
typedef struct _pres_user_t {
guint ctx_id;
@@ -115,20 +115,6 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-pres_init(void)
-{
- pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash,
- pres_ctx_oid_equal);
-
-}
-
-static void
-pres_cleanup(void)
-{
- g_hash_table_destroy(pres_ctx_oid_table);
-}
-
-static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
{
pres_ctx_oid_t *pco, *tmppco;
@@ -151,11 +137,11 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
}
/* if this ctx already exists, remove the old one first */
- tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
+ tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, pco);
if (tmppco) {
- g_hash_table_remove(pres_ctx_oid_table, tmppco);
+ wmem_map_remove(pres_ctx_oid_table, tmppco);
}
- g_hash_table_insert(pres_ctx_oid_table, pco, pco);
+ wmem_map_insert(pres_ctx_oid_table, pco, pco);
}
static char *
@@ -191,7 +177,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
pco.idx = 0;
}
- tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
+ tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, &pco);
if (tmppco) {
return tmppco->oid;
}
@@ -440,8 +426,7 @@ void proto_register_pres(void) {
proto_register_subtree_array(ett, array_length(ett));
expert_pres = expert_register_protocol(proto_pres);
expert_register_field_array(expert_pres, ei, array_length(ei));
- register_init_routine(pres_init);
- register_cleanup_routine(pres_cleanup);
+ pres_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), pres_ctx_oid_hash, pres_ctx_oid_equal);
pres_module = prefs_register_protocol(proto_pres, NULL);
diff --git a/epan/dissectors/asn1/ros/packet-ros-template.c b/epan/dissectors/asn1/ros/packet-ros-template.c
index 4364de44af..eabe705df6 100644
--- a/epan/dissectors/asn1/ros/packet-ros-template.c
+++ b/epan/dissectors/asn1/ros/packet-ros-template.c
@@ -49,13 +49,10 @@ static guint32 invokeid;
static dissector_handle_t ros_handle = NULL;
typedef struct ros_conv_info_t {
- struct ros_conv_info_t *next;
- GHashTable *unmatched; /* unmatched operations */
- GHashTable *matched; /* matched operations */
+ wmem_map_t *unmatched; /* unmatched operations */
+ wmem_map_t *matched; /* matched operations */
} ros_conv_info_t;
-static ros_conv_info_t *ros_info_items = NULL;
-
typedef struct ros_call_response {
gboolean is_request;
guint32 req_frame;
@@ -89,14 +86,12 @@ static expert_field ei_ros_unknown_ros_pdu = EI_INIT;
static dissector_table_t ros_oid_dissector_table=NULL;
-static GHashTable *oid_table=NULL;
-static GHashTable *protocol_table=NULL;
+static wmem_map_t *protocol_table=NULL;
void
register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_rtse)
{
dissector_add_string("ros.oid", oid, dissector);
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
if(!uses_rtse)
/* if we are not using RTSE, then we must register ROS with BER (ACSE) */
@@ -106,8 +101,7 @@ register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector,
void
register_ros_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name, gboolean uses_rtse)
{
- g_hash_table_insert(protocol_table, (gpointer)oid, (gpointer)rinfo);
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
+ wmem_map_insert(protocol_table, (gpointer)oid, (gpointer)rinfo);
if(!uses_rtse)
/* if we are not using RTSE, then we must register ROS with BER (ACSE) */
@@ -151,7 +145,7 @@ ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
proto_item *item=NULL;
proto_tree *ros_tree=NULL;
- if((session != NULL) && ((rinfo = (ros_info_t*)g_hash_table_lookup(protocol_table, oid)) != NULL)) {
+ if((session != NULL) && ((rinfo = (ros_info_t*)wmem_map_lookup(protocol_table, oid)) != NULL)) {
if(tree){
item = proto_tree_add_item(tree, *(rinfo->proto), tvb, 0, -1, ENC_NA);
@@ -280,9 +274,19 @@ static ros_call_response_t *
ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint invokeId, gboolean isInvoke)
{
ros_call_response_t rcr, *rcrp=NULL;
- ros_conv_info_t *ros_info = ros_info_items;
+ ros_conv_info_t *ros_info;
+ conversation_t *conversation;
/* first see if we have already matched this */
+ conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
+ pinfo->ptype, pinfo->srcport,
+ pinfo->destport, 0);
+ if (conversation == NULL)
+ return NULL;
+
+ ros_info = (ros_conv_info_t *)conversation_get_proto_data(conversation, proto_ros);
+ if (ros_info == NULL)
+ return NULL;
rcr.invokeId=invokeId;
rcr.is_request = isInvoke;
@@ -295,7 +299,7 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcr.rep_frame=pinfo->num;
}
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->matched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->matched, &rcr);
if(rcrp) {
/* we have found a match */
@@ -313,10 +317,10 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcr.invokeId=invokeId;
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->unmatched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->unmatched, &rcr);
if(rcrp){
- g_hash_table_remove(ros_info->unmatched, rcrp);
+ wmem_map_remove(ros_info->unmatched, rcrp);
}
/* if we can't reuse the old one, grab a new chunk */
@@ -328,7 +332,7 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcrp->req_time=pinfo->abs_ts;
rcrp->rep_frame=0;
rcrp->is_request=TRUE;
- g_hash_table_insert(ros_info->unmatched, rcrp, rcrp);
+ wmem_map_insert(ros_info->unmatched, rcrp, rcrp);
return NULL;
} else {
@@ -336,15 +340,15 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
/* this is a result - it should be in our unmatched list */
rcr.invokeId=invokeId;
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->unmatched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->unmatched, &rcr);
if(rcrp){
if(!rcrp->rep_frame){
- g_hash_table_remove(ros_info->unmatched, rcrp);
+ wmem_map_remove(ros_info->unmatched, rcrp);
rcrp->rep_frame=pinfo->num;
rcrp->is_request=FALSE;
- g_hash_table_insert(ros_info->matched, rcrp, rcrp);
+ wmem_map_insert(ros_info->matched, rcrp, rcrp);
}
}
}
@@ -405,14 +409,11 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
/* No. Attach that information to the conversation. */
- ros_info = (ros_conv_info_t *)g_malloc(sizeof(ros_conv_info_t));
- ros_info->matched=g_hash_table_new(ros_info_hash_matched, ros_info_equal_matched);
- ros_info->unmatched=g_hash_table_new(ros_info_hash_unmatched, ros_info_equal_unmatched);
+ ros_info = (ros_conv_info_t *)wmem_new0(wmem_file_scope(), ros_conv_info_t);
+ ros_info->matched=wmem_map_new(wmem_file_scope(), ros_info_hash_matched, ros_info_equal_matched);
+ ros_info->unmatched=wmem_map_new(wmem_file_scope(), ros_info_hash_unmatched, ros_info_equal_unmatched);
conversation_add_proto_data(conversation, proto_ros, ros_info);
-
- ros_info->next = ros_info_items;
- ros_info_items = ros_info;
}
item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA);
@@ -436,29 +437,6 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
return tvb_captured_length(tvb);
}
-static void
-ros_cleanup(void)
-{
- ros_conv_info_t *ros_info;
-
- /* Free up state attached to the ros_info structures */
- for (ros_info = ros_info_items; ros_info != NULL; ) {
- ros_conv_info_t *last;
-
- g_hash_table_destroy(ros_info->matched);
- ros_info->matched=NULL;
- g_hash_table_destroy(ros_info->unmatched);
- ros_info->unmatched=NULL;
-
- last = ros_info;
- ros_info = ros_info->next;
- g_free(last);
- }
-
- ros_info_items = NULL;
-
-}
-
/*--- proto_register_ros -------------------------------------------*/
void proto_register_ros(void) {
@@ -514,10 +492,7 @@ void proto_register_ros(void) {
expert_register_field_array(expert_ros, ei, array_length(ei));
ros_oid_dissector_table = register_dissector_table("ros.oid", "ROS OID Dissectors", proto_ros, FT_STRING, BASE_NONE);
- oid_table=g_hash_table_new(g_str_hash, g_str_equal);
- protocol_table=g_hash_table_new(g_str_hash, g_str_equal);
-
- register_cleanup_routine(ros_cleanup);
+ protocol_table = wmem_map_new(wmem_epan_scope(), wmem_str_hash, g_str_equal);
}
diff --git a/epan/dissectors/asn1/rtse/packet-rtse-template.c b/epan/dissectors/asn1/rtse/packet-rtse-template.c
index 56d59838aa..b2c3c956a0 100644
--- a/epan/dissectors/asn1/rtse/packet-rtse-template.c
+++ b/epan/dissectors/asn1/rtse/packet-rtse-template.c
@@ -68,7 +68,6 @@ static expert_field ei_rtse_abstract_syntax = EI_INIT;
static dissector_table_t rtse_oid_dissector_table=NULL;
static dissector_handle_t rtse_handle = NULL;
-static GHashTable *oid_table=NULL;
static gint ett_rtse_unknown = -1;
static reassembly_table rtse_reassembly_table;
@@ -121,9 +120,6 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
if (ros_handle == NULL)
ros_handle = find_dissector("ros");
- /* save the name - but not used */
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
-
/* register RTSE with the BER (ACSE) */
register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
@@ -392,9 +388,6 @@ void proto_register_rtse(void) {
" in the TCP protocol settings.", &rtse_reassemble);
rtse_oid_dissector_table = register_dissector_table("rtse.oid", "RTSE OID Dissectors", proto_rtse, FT_STRING, BASE_NONE);
- oid_table=g_hash_table_new(g_str_hash, g_str_equal);
-
-
}
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c
index 0795d27516..ebb0855849 100644
--- a/epan/dissectors/packet-acse.c
+++ b/epan/dissectors/packet-acse.c
@@ -251,7 +251,7 @@ typedef struct _acse_ctx_oid_t {
guint32 ctx_id;
char *oid;
} acse_ctx_oid_t;
-static GHashTable *acse_ctx_oid_table = NULL;
+static wmem_map_t *acse_ctx_oid_table = NULL;
static guint
acse_ctx_oid_hash(gconstpointer k)
@@ -269,18 +269,6 @@ acse_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-acse_init(void)
-{
- if (acse_ctx_oid_table) {
- g_hash_table_destroy(acse_ctx_oid_table);
- acse_ctx_oid_table = NULL;
- }
- acse_ctx_oid_table = g_hash_table_new(acse_ctx_oid_hash,
- acse_ctx_oid_equal);
-
-}
-
-static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
@@ -289,18 +277,18 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
aco->oid=wmem_strdup(wmem_file_scope(), oid);
/* if this ctx already exists, remove the old one first */
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, aco);
if (tmpaco) {
- g_hash_table_remove(acse_ctx_oid_table, tmpaco);
+ wmem_map_remove(acse_ctx_oid_table, tmpaco);
}
- g_hash_table_insert(acse_ctx_oid_table, aco, aco);
+ wmem_map_insert(acse_ctx_oid_table, aco, aco);
}
static char *
find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
{
acse_ctx_oid_t aco, *tmpaco;
aco.ctx_id=idx;
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, &aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, &aco);
if (tmpaco) {
return tmpaco->oid;
}
@@ -1699,7 +1687,7 @@ dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
/*--- End of included file: packet-acse-fn.c ---*/
-#line 152 "./asn1/acse/packet-acse-template.c"
+#line 140 "./asn1/acse/packet-acse-template.c"
/*
@@ -2248,7 +2236,7 @@ void proto_register_acse(void) {
NULL, HFILL }},
/*--- End of included file: packet-acse-hfarr.c ---*/
-#line 268 "./asn1/acse/packet-acse-template.c"
+#line 256 "./asn1/acse/packet-acse-template.c"
};
/* List of subtrees */
@@ -2294,7 +2282,7 @@ void proto_register_acse(void) {
&ett_acse_Authentication_value,
/*--- End of included file: packet-acse-ettarr.c ---*/
-#line 274 "./asn1/acse/packet-acse-template.c"
+#line 262 "./asn1/acse/packet-acse-template.c"
};
static ei_register_info ei[] = {
@@ -2318,6 +2306,11 @@ void proto_register_acse(void) {
proto_register_subtree_array(ett, array_length(ett));
expert_acse = expert_register_protocol(proto_acse);
expert_register_field_array(expert_acse, ei, array_length(ei));
+
+#if NOT_NEEDED
+ acse_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), acse_ctx_oid_hash,
+ acse_ctx_oid_equal);
+#endif
}
diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c
index 7903182ddc..5cd6d2dad3 100644
--- a/epan/dissectors/packet-ansi_map.c
+++ b/epan/dissectors/packet-ansi_map.c
@@ -1175,20 +1175,7 @@ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo
/* Transaction table */
-static GHashTable *TransactionId_table=NULL;
-
-static void
-ansi_map_init(void)
-{
- TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void
-ansi_map_cleanup(void)
-{
- /* Destroy any existing memory chunks / hashes. */
- g_hash_table_destroy(TransactionId_table);
-}
+static wmem_map_t *TransactionId_table=NULL;
/* Store Invoke information needed for the corresponding reply */
static void
@@ -1220,7 +1207,7 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
break;
}
/* If the entry allready exists don't owervrite it */
- ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)g_hash_table_lookup(TransactionId_table,buf);
+ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table,buf);
if(ansi_map_saved_invokedata)
return;
@@ -1228,7 +1215,7 @@ update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_privat
ansi_map_saved_invokedata->opcode = p_private_tcap->d.OperationCode_private;
ansi_map_saved_invokedata->ServiceIndicator = ServiceIndicator;
- g_hash_table_insert(TransactionId_table,
+ wmem_map_insert(TransactionId_table,
wmem_strdup(wmem_file_scope(), buf),
ansi_map_saved_invokedata);
@@ -15286,7 +15273,7 @@ dissect_ansi_map_QualificationRequest2Res(gboolean implicit_tag _U_, tvbuff_t *t
/*--- End of included file: packet-ansi_map-fn.c ---*/
-#line 3641 "./asn1/ansi_map/packet-ansi_map-template.c"
+#line 3628 "./asn1/ansi_map/packet-ansi_map-template.c"
/*
* 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301
@@ -16012,7 +15999,7 @@ find_saved_invokedata(asn1_ctx_t *actx, struct ansi_tcap_private_t *p_private_tc
}
/*g_warning("Find Hash string %s pkt: %u",buf,actx->pinfo->num);*/
- ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
+ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table, buf);
if(ansi_map_saved_invokedata){
OperationCode = ansi_map_saved_invokedata->opcode & 0xff;
ServiceIndicator = ansi_map_saved_invokedata->ServiceIndicator;
@@ -19234,7 +19221,7 @@ void proto_register_ansi_map(void) {
NULL, HFILL }},
/*--- End of included file: packet-ansi_map-hfarr.c ---*/
-#line 5396 "./asn1/ansi_map/packet-ansi_map-template.c"
+#line 5383 "./asn1/ansi_map/packet-ansi_map-template.c"
};
/* List of subtrees */
@@ -19495,7 +19482,7 @@ void proto_register_ansi_map(void) {
&ett_ansi_map_ReturnData,
/*--- End of included file: packet-ansi_map-ettarr.c ---*/
-#line 5429 "./asn1/ansi_map/packet-ansi_map-template.c"
+#line 5416 "./asn1/ansi_map/packet-ansi_map-template.c"
};
static ei_register_info ei[] = {
@@ -19569,8 +19556,7 @@ void proto_register_ansi_map(void) {
"Type of matching invoke/response, risk of mismatch if loose matching chosen",
&ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
- register_init_routine(&ansi_map_init);
- register_cleanup_routine(&ansi_map_cleanup);
+ TransactionId_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
register_stat_tap_table_ui(&stat_table);
}
diff --git a/epan/dissectors/packet-ansi_tcap.c b/epan/dissectors/packet-ansi_tcap.c
index 4a79793ee8..753cb18e6b 100644
--- a/epan/dissectors/packet-ansi_tcap.c
+++ b/epan/dissectors/packet-ansi_tcap.c
@@ -237,20 +237,7 @@ struct ansi_tcap_invokedata_t {
gint32 OperationCode_national;
};
-static GHashTable *TransactionId_table=NULL;
-
-static void
-ansi_tcap_init(void)
-{
- TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void
-ansi_tcap_cleanup(void)
-{
- /* Destroy any existing memory chunks / hashes. */
- g_hash_table_destroy(TransactionId_table);
-}
+static wmem_map_t *TransactionId_table=NULL;
/* Store Invoke information needed for the corresponding reply */
static void
@@ -280,7 +267,7 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
}
/* If the entry allready exists don't owervrite it */
- ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table,buf);
+ ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)wmem_map_lookup(TransactionId_table,buf);
if(ansi_tcap_saved_invokedata)
return;
@@ -289,7 +276,7 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
ansi_tcap_saved_invokedata->OperationCode_national = ansi_tcap_private.d.OperationCode_national;
ansi_tcap_saved_invokedata->OperationCode_private = ansi_tcap_private.d.OperationCode_private;
- g_hash_table_insert(TransactionId_table,
+ wmem_map_insert(TransactionId_table,
wmem_strdup(wmem_file_scope(), buf),
ansi_tcap_saved_invokedata);
/*
@@ -328,7 +315,7 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
break;
}
- ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)g_hash_table_lookup(TransactionId_table, buf);
+ ansi_tcap_saved_invokedata = (struct ansi_tcap_invokedata_t *)wmem_map_lookup(TransactionId_table, buf);
if(ansi_tcap_saved_invokedata){
ansi_tcap_private.d.OperationCode = ansi_tcap_saved_invokedata->OperationCode;
ansi_tcap_private.d.OperationCode_national = ansi_tcap_saved_invokedata->OperationCode_national;
@@ -1388,7 +1375,7 @@ dissect_ansi_tcap_PackageType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
/*--- End of included file: packet-ansi_tcap-fn.c ---*/
-#line 331 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 318 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
@@ -1732,7 +1719,7 @@ proto_register_ansi_tcap(void)
NULL, HFILL }},
/*--- End of included file: packet-ansi_tcap-hfarr.c ---*/
-#line 466 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 453 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
};
/* Setup protocol subtree array */
@@ -1770,7 +1757,7 @@ proto_register_ansi_tcap(void)
&ett_ansi_tcap_T_paramSet,
/*--- End of included file: packet-ansi_tcap-ettarr.c ---*/
-#line 477 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 464 "./asn1/ansi_tcap/packet-ansi_tcap-template.c"
};
static ei_register_info ei[] = {
@@ -1805,6 +1792,5 @@ proto_register_ansi_tcap(void)
"Type of matching invoke/response, risk of mismatch if loose matching chosen",
&ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
- register_init_routine(&ansi_tcap_init);
- register_cleanup_routine(&ansi_tcap_cleanup);
+ TransactionId_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
}
diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c
index c955bd3fb5..db7be2b10e 100644
--- a/epan/dissectors/packet-camel.c
+++ b/epan/dissectors/packet-camel.c
@@ -865,7 +865,7 @@ const char *camel_obj_id = NULL;
gboolean is_ExtensionField =FALSE;
/* Global hash tables*/
-static GHashTable *srt_calls = NULL;
+static wmem_map_t *srt_calls = NULL;
static guint32 camelsrt_global_SessionId=1;
static int camel_opcode_type;
@@ -7402,7 +7402,7 @@ static struct camelsrt_call_t *
find_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
{
struct camelsrt_call_t *p_camelsrt_call = NULL;
- p_camelsrt_call = (struct camelsrt_call_t *)g_hash_table_lookup(srt_calls, p_camelsrt_call_key);
+ p_camelsrt_call = (struct camelsrt_call_t *)wmem_map_lookup(srt_calls, p_camelsrt_call_key);
#ifdef DEBUG_CAMELSRT
if(p_camelsrt_call) {
@@ -7447,7 +7447,7 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
dbg(10,"D%d ", p_new_camelsrt_call->session_id);
#endif
/* store it */
- g_hash_table_insert(srt_calls, p_new_camelsrt_call_key, p_new_camelsrt_call);
+ wmem_map_insert(srt_calls, p_new_camelsrt_call_key, p_new_camelsrt_call);
return p_new_camelsrt_call;
}
@@ -7458,8 +7458,6 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
static void
camelsrt_init_routine(void)
{
- /* create new hash-table for SRT */
- srt_calls = g_hash_table_new(camelsrt_call_hash, camelsrt_call_equal);
/* Reset the session counter */
camelsrt_global_SessionId=1;
@@ -7470,13 +7468,6 @@ camelsrt_init_routine(void)
gcamel_DisplaySRT=gcamel_PersistentSRT || gcamel_HandleSRT&gcamel_StatSRT;
}
-static void
-camelsrt_cleanup_routine(void)
-{
- /* free hash-table for SRT */
- g_hash_table_destroy(srt_calls);
-}
-
/*
* Update a record with the data of the Request
@@ -7527,7 +7518,7 @@ camelsrt_close_call_matching(packet_info *pinfo,
p_camelsrt_info->msginfo[CAMELSRT_SESSION].req_time = p_camelsrt_call->category[CAMELSRT_SESSION].req_time;
if ( !gcamel_PersistentSRT ) {
- g_hash_table_remove(srt_calls, &camelsrt_call_key);
+ wmem_map_remove(srt_calls, &camelsrt_call_key);
#ifdef DEBUG_CAMELSRT
dbg(20,"remove hash ");
#endif
@@ -7590,7 +7581,7 @@ camelsrt_begin_call_matching(packet_info *pinfo,
dbg(10,"\n Session begin #%u\n", pinfo->num);
dbg(11,"Search key %lu ",camelsrt_call_key.SessionIdKey);
#endif
- p_camelsrt_call = (struct camelsrt_call_t *)g_hash_table_lookup(srt_calls, &camelsrt_call_key);
+ p_camelsrt_call = (struct camelsrt_call_t *)wmem_map_lookup(srt_calls, &camelsrt_call_key);
if (p_camelsrt_call) {
/* We have seen this request before -> do nothing */
#ifdef DEBUG_CAMELSRT
@@ -8293,7 +8284,7 @@ void proto_reg_handoff_camel(void) {
/*--- End of included file: packet-camel-dis-tab.c ---*/
-#line 1328 "./asn1/camel/packet-camel-template.c"
+#line 1319 "./asn1/camel/packet-camel-template.c"
} else {
range_foreach(ssn_range, range_delete_callback);
wmem_free(wmem_epan_scope(), ssn_range);
@@ -10415,7 +10406,7 @@ void proto_register_camel(void) {
"InvokeId_present", HFILL }},
/*--- End of included file: packet-camel-hfarr.c ---*/
-#line 1501 "./asn1/camel/packet-camel-template.c"
+#line 1492 "./asn1/camel/packet-camel-template.c"
};
/* List of subtrees */
@@ -10633,7 +10624,7 @@ void proto_register_camel(void) {
&ett_camel_InvokeId,
/*--- End of included file: packet-camel-ettarr.c ---*/
-#line 1518 "./asn1/camel/packet-camel-template.c"
+#line 1509 "./asn1/camel/packet-camel-template.c"
};
static ei_register_info ei[] = {
@@ -10717,7 +10708,10 @@ void proto_register_camel(void) {
/* Routine for statistic */
register_init_routine(&camelsrt_init_routine);
- register_cleanup_routine(&camelsrt_cleanup_routine);
+
+ /* create new hash-table for SRT */
+ srt_calls = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), camelsrt_call_hash, camelsrt_call_equal);
+
camel_tap=register_tap(PSNAME);
register_srt_table(proto_camel, PSNAME, 1, camelstat_packet, camelstat_init, NULL);
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);
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index bc8d180694..8590131862 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -363,7 +363,7 @@ typedef struct _olc_info_t {
channel_info_t rev_lc;
} olc_info_t;
-static GHashTable* h245_pending_olc_reqs = NULL;
+static wmem_map_t* h245_pending_olc_reqs = NULL;
static gboolean fast_start = FALSE;
static olc_info_t *upcoming_olc = NULL;
static channel_info_t *upcoming_channel = NULL;
@@ -412,7 +412,7 @@ typedef struct {
h223_lc_params *rev_channel_params;
} h223_pending_olc;
-static GHashTable* h223_pending_olc_reqs[] = { NULL, NULL };
+static wmem_map_t* h223_pending_olc_reqs[] = { NULL, NULL };
static dissector_handle_t h245_lc_dissector;
static guint16 h245_lc_temp;
static guint16 h223_fw_lc_num;
@@ -422,34 +422,13 @@ static h223_lc_params *h223_fw_lc_params;
static h223_lc_params *h223_rev_lc_params;
static h223_add_lc_handle_t h223_add_lc_handle = NULL;
-static void h223_lc_init_dir( int dir )
-{
- if ( h223_pending_olc_reqs[dir] )
- g_hash_table_destroy( h223_pending_olc_reqs[dir] );
- h223_pending_olc_reqs[dir] = g_hash_table_new( g_direct_hash, g_direct_equal );
-}
-
static void h223_lc_init( void )
{
- h223_lc_init_dir( P2P_DIR_SENT );
- h223_lc_init_dir( P2P_DIR_RECV );
h223_lc_params_temp = NULL;
h245_lc_dissector = NULL;
h223_fw_lc_num = 0;
}
-static void h245_init(void)
-{
- h245_pending_olc_reqs = g_hash_table_new(g_str_hash, g_str_equal);
-
- h223_lc_init();
-}
-
-static void h245_cleanup(void)
-{
- g_hash_table_destroy(h245_pending_olc_reqs);
-}
-
void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
{
h223_add_lc_handle = handle;
@@ -1942,7 +1921,7 @@ static int hf_h245_encrypted = -1; /* OCTET_STRING */
static int hf_h245_encryptedAlphanumeric = -1; /* EncryptedAlphanumeric */
/*--- End of included file: packet-h245-hf.c ---*/
-#line 408 "./asn1/h245/packet-h245-template.c"
+#line 387 "./asn1/h245/packet-h245-template.c"
/* Initialize the subtree pointers */
static int ett_h245 = -1;
@@ -2443,7 +2422,7 @@ static gint ett_h245_FlowControlIndication = -1;
static gint ett_h245_MobileMultilinkReconfigurationIndication = -1;
/*--- End of included file: packet-h245-ett.c ---*/
-#line 413 "./asn1/h245/packet-h245-template.c"
+#line 392 "./asn1/h245/packet-h245-template.c"
/* Forward declarations */
static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
@@ -8782,14 +8761,14 @@ dissect_h245_OpenLogicalChannel(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
pending->rev_channel_params = h223_rev_lc_params;
temp = h223_fw_lc_num;
if (actx->pinfo->p2p_dir > -1)
- g_hash_table_insert(h223_pending_olc_reqs[actx->pinfo->p2p_dir], GINT_TO_POINTER(temp), pending);
+ wmem_map_insert(h223_pending_olc_reqs[actx->pinfo->p2p_dir], GINT_TO_POINTER(temp), pending);
}
if (upcoming_olc) {
if (fast_start) {
h245_setup_channels(actx->pinfo, &upcoming_olc->rev_lc);
} else {
- g_hash_table_insert(h245_pending_olc_reqs,
+ wmem_map_insert(h245_pending_olc_reqs,
wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &actx->pinfo->dst, &actx->pinfo->src)),
upcoming_olc);
}
@@ -11130,7 +11109,7 @@ dissect_h245_OpenLogicalChannelAck(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
actx->pinfo->p2p_dir = P2P_DIR_RECV;
else
actx->pinfo->p2p_dir = P2P_DIR_SENT;
- pend = (h223_pending_olc *)g_hash_table_lookup( h223_pending_olc_reqs[actx->pinfo->p2p_dir], GINT_TO_POINTER(temp) );
+ pend = (h223_pending_olc *)wmem_map_lookup( h223_pending_olc_reqs[actx->pinfo->p2p_dir], GINT_TO_POINTER(temp) );
if (pend) {
DISSECTOR_ASSERT( ( h223_rev_lc_num && pend->rev_channel_params)
|| (!h223_rev_lc_num && !pend->rev_channel_params) );
@@ -11146,7 +11125,7 @@ dissect_h245_OpenLogicalChannelAck(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
if (upcoming_olc) {
olc_key = gen_olc_key(upcoming_olc->fwd_lc_num, &actx->pinfo->src, &actx->pinfo->dst);
- olc_req = (olc_info_t *)g_hash_table_lookup(h245_pending_olc_reqs, olc_key);
+ olc_req = (olc_info_t *)wmem_map_lookup(h245_pending_olc_reqs, olc_key);
if (olc_req) {
update_unicast_addr(&olc_req->fwd_lc.media_addr, &upcoming_olc->fwd_lc.media_addr);
update_unicast_addr(&olc_req->fwd_lc.media_control_addr, &upcoming_olc->fwd_lc.media_control_addr);
@@ -11154,7 +11133,7 @@ dissect_h245_OpenLogicalChannelAck(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
update_unicast_addr(&olc_req->rev_lc.media_control_addr, &upcoming_olc->rev_lc.media_control_addr);
h245_setup_channels(actx->pinfo, &olc_req->fwd_lc);
h245_setup_channels(actx->pinfo, &olc_req->rev_lc);
- g_hash_table_remove(h245_pending_olc_reqs, olc_key);
+ wmem_map_remove(h245_pending_olc_reqs, olc_key);
} else {
h245_setup_channels(actx->pinfo, &upcoming_olc->fwd_lc);
}
@@ -14530,7 +14509,7 @@ static int dissect_OpenLogicalChannel_PDU(tvbuff_t *tvb _U_, packet_info *pinfo
/*--- End of included file: packet-h245-fn.c ---*/
-#line 422 "./asn1/h245/packet-h245-template.c"
+#line 401 "./asn1/h245/packet-h245-template.c"
static int
dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
@@ -20229,7 +20208,7 @@ void proto_register_h245(void) {
NULL, HFILL }},
/*--- End of included file: packet-h245-hfarr.c ---*/
-#line 508 "./asn1/h245/packet-h245-template.c"
+#line 487 "./asn1/h245/packet-h245-template.c"
};
/* List of subtrees */
@@ -20732,14 +20711,17 @@ void proto_register_h245(void) {
&ett_h245_MobileMultilinkReconfigurationIndication,
/*--- End of included file: packet-h245-ettarr.c ---*/
-#line 515 "./asn1/h245/packet-h245-template.c"
+#line 494 "./asn1/h245/packet-h245-template.c"
};
module_t *h245_module;
/* Register protocol */
proto_h245 = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_init_routine(h245_init);
- register_cleanup_routine(h245_cleanup);
+ h223_pending_olc_reqs[P2P_DIR_SENT] = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal );
+ h223_pending_olc_reqs[P2P_DIR_RECV] = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal );
+ h245_pending_olc_reqs = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal);
+
+ register_init_routine(h223_lc_init);
/* Register fields and subtrees */
proto_register_field_array(proto_h245, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c
index 4b2f506081..f3e66dc04b 100644
--- a/epan/dissectors/packet-lte-rrc.c
+++ b/epan/dissectors/packet-lte-rrc.c
@@ -73,10 +73,10 @@ static dissector_handle_t gsm_a_dtap_handle = NULL;
static dissector_handle_t gsm_rlcmac_dl_handle = NULL;
static dissector_handle_t lte_rrc_dl_ccch_handle;
-static GHashTable *lte_rrc_etws_cmas_dcs_hash = NULL;
+static wmem_map_t *lte_rrc_etws_cmas_dcs_hash = NULL;
/* Keep track of where/how the System Info value has changed */
-static GHashTable *lte_rrc_system_info_value_changed_hash = NULL;
+static wmem_map_t *lte_rrc_system_info_value_changed_hash = NULL;
static guint8 system_info_value_current;
static gboolean system_info_value_current_set;
@@ -26087,7 +26087,7 @@ dissect_lte_rrc_T_systemInfoValueTag(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx
if (!actx->pinfo->fd->flags.visited) {
if (system_info_value_current_set && (value != system_info_value_current)) {
/* Add entry to the hash table. Offset by one to distinguish 0 from lookup failure */
- g_hash_table_insert(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num),
+ wmem_map_insert(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num),
GUINT_TO_POINTER(system_info_value_current+1));
}
system_info_value_current_set = TRUE;
@@ -26095,7 +26095,7 @@ dissect_lte_rrc_T_systemInfoValueTag(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx
}
else {
/* Look up indication of changed info value from hash table */
- gpointer p_previous = g_hash_table_lookup(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num));
+ gpointer p_previous = wmem_map_lookup(lte_rrc_system_info_value_changed_hash, GUINT_TO_POINTER(actx->pinfo->num));
if (p_previous != NULL) {
/* Subtract one from stored result to get previous value */
guint32 previous = GPOINTER_TO_UINT(p_previous) - 1;
@@ -38409,7 +38409,7 @@ dissect_lte_rrc_T_warningMessageSegment(tvbuff_t *tvb _U_, int offset _U_, asn1_
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB11 warning message",
frag_data, &lte_rrc_sib11_frag_items, NULL, subtree);
- p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
+ p_dcs = wmem_map_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
if (frag_tvb && p_dcs) {
dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
@@ -38433,7 +38433,7 @@ dissect_lte_rrc_T_dataCodingScheme(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
- g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
+ wmem_map_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
GUINT_TO_POINTER(dataCodingScheme));
}
@@ -38560,7 +38560,7 @@ dissect_lte_rrc_T_warningMessageSegment_r9(tvbuff_t *tvb _U_, int offset _U_, as
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment);
frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB12 warning message",
frag_data, &lte_rrc_sib12_frag_items, NULL, subtree);
- p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
+ p_dcs = wmem_map_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)));
if (frag_tvb && p_dcs) {
dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs));
}
@@ -38584,7 +38584,7 @@ dissect_lte_rrc_T_dataCodingScheme_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ct
guint32 dataCodingScheme;
subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme);
dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0);
- g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
+ wmem_map_insert(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx)),
GUINT_TO_POINTER(dataCodingScheme));
}
@@ -69891,20 +69891,6 @@ dissect_lte_rrc_PCCH_NB(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
return tvb_captured_length(tvb);
}
-static void
-lte_rrc_init_protocol(void)
-{
- lte_rrc_etws_cmas_dcs_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
- lte_rrc_system_info_value_changed_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
-}
-
-static void
-lte_rrc_cleanup_protocol(void)
-{
- g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
- g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
-}
-
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_lte_rrc(void) {
@@ -87884,7 +87870,7 @@ void proto_register_lte_rrc(void) {
"T_n311_r13_01", HFILL }},
/*--- End of included file: packet-lte-rrc-hfarr.c ---*/
-#line 3210 "./asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 3196 "./asn1/lte-rrc/packet-lte-rrc-template.c"
{ &hf_lte_rrc_eutra_cap_feat_group_ind_1,
{ "Indicator 1", "lte-rrc.eutra_cap_feat_group_ind_1",
@@ -90776,7 +90762,7 @@ void proto_register_lte_rrc(void) {
&ett_lte_rrc_UE_TimersAndConstants_NB_r13,
/*--- End of included file: packet-lte-rrc-ettarr.c ---*/
-#line 3937 "./asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 3923 "./asn1/lte-rrc/packet-lte-rrc-template.c"
&ett_lte_rrc_featureGroupIndicators,
&ett_lte_rrc_featureGroupIndRel9Add,
@@ -90876,10 +90862,10 @@ void proto_register_lte_rrc(void) {
/*--- End of included file: packet-lte-rrc-dis-reg.c ---*/
-#line 4011 "./asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 3997 "./asn1/lte-rrc/packet-lte-rrc-template.c"
- register_init_routine(&lte_rrc_init_protocol);
- register_cleanup_routine(&lte_rrc_cleanup_protocol);
+ lte_rrc_etws_cmas_dcs_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
+ lte_rrc_system_info_value_changed_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
reassembly_table_register(&lte_rrc_sib11_reassembly_table,
&addresses_reassembly_table_functions);
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index 7fcd15060f..bf48babff6 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -77,7 +77,7 @@ typedef struct _pres_ctx_oid_t {
char *oid;
guint32 idx;
} pres_ctx_oid_t;
-static GHashTable *pres_ctx_oid_table = NULL;
+static wmem_map_t *pres_ctx_oid_table = NULL;
typedef struct _pres_user_t {
guint ctx_id;
@@ -247,20 +247,6 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-pres_init(void)
-{
- pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash,
- pres_ctx_oid_equal);
-
-}
-
-static void
-pres_cleanup(void)
-{
- g_hash_table_destroy(pres_ctx_oid_table);
-}
-
-static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
{
pres_ctx_oid_t *pco, *tmppco;
@@ -283,11 +269,11 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
}
/* if this ctx already exists, remove the old one first */
- tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
+ tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, pco);
if (tmppco) {
- g_hash_table_remove(pres_ctx_oid_table, tmppco);
+ wmem_map_remove(pres_ctx_oid_table, tmppco);
}
- g_hash_table_insert(pres_ctx_oid_table, pco, pco);
+ wmem_map_insert(pres_ctx_oid_table, pco, pco);
}
static char *
@@ -323,7 +309,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
pco.idx = 0;
}
- tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
+ tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, &pco);
if (tmppco) {
return tmppco->oid;
}
@@ -1359,7 +1345,7 @@ static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
/*--- End of included file: packet-pres-fn.c ---*/
-#line 224 "./asn1/pres/packet-pres-template.c"
+#line 210 "./asn1/pres/packet-pres-template.c"
/*
@@ -1841,7 +1827,7 @@ void proto_register_pres(void) {
NULL, HFILL }},
/*--- End of included file: packet-pres-hfarr.c ---*/
-#line 393 "./asn1/pres/packet-pres-template.c"
+#line 379 "./asn1/pres/packet-pres-template.c"
};
/* List of subtrees */
@@ -1888,7 +1874,7 @@ void proto_register_pres(void) {
&ett_pres_UD_type,
/*--- End of included file: packet-pres-ettarr.c ---*/
-#line 399 "./asn1/pres/packet-pres-template.c"
+#line 385 "./asn1/pres/packet-pres-template.c"
};
static ei_register_info ei[] = {
@@ -1933,8 +1919,7 @@ void proto_register_pres(void) {
proto_register_subtree_array(ett, array_length(ett));
expert_pres = expert_register_protocol(proto_pres);
expert_register_field_array(expert_pres, ei, array_length(ei));
- register_init_routine(pres_init);
- register_cleanup_routine(pres_cleanup);
+ pres_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), pres_ctx_oid_hash, pres_ctx_oid_equal);
pres_module = prefs_register_protocol(proto_pres, NULL);
diff --git a/epan/dissectors/packet-ros.c b/epan/dissectors/packet-ros.c
index 1d68c5b188..38128bc48c 100644
--- a/epan/dissectors/packet-ros.c
+++ b/epan/dissectors/packet-ros.c
@@ -57,13 +57,10 @@ static guint32 invokeid;
static dissector_handle_t ros_handle = NULL;
typedef struct ros_conv_info_t {
- struct ros_conv_info_t *next;
- GHashTable *unmatched; /* unmatched operations */
- GHashTable *matched; /* matched operations */
+ wmem_map_t *unmatched; /* unmatched operations */
+ wmem_map_t *matched; /* matched operations */
} ros_conv_info_t;
-static ros_conv_info_t *ros_info_items = NULL;
-
typedef struct ros_call_response {
gboolean is_request;
guint32 req_frame;
@@ -109,7 +106,7 @@ static int hf_ros_local = -1; /* INTEGER */
static int hf_ros_global = -1; /* OBJECT_IDENTIFIER */
/*--- End of included file: packet-ros-hf.c ---*/
-#line 73 "./asn1/ros/packet-ros-template.c"
+#line 70 "./asn1/ros/packet-ros-template.c"
/* Initialize the subtree pointers */
static gint ett_ros = -1;
@@ -136,21 +133,19 @@ static gint ett_ros_InvokeId = -1;
static gint ett_ros_Code = -1;
/*--- End of included file: packet-ros-ett.c ---*/
-#line 86 "./asn1/ros/packet-ros-template.c"
+#line 83 "./asn1/ros/packet-ros-template.c"
static expert_field ei_ros_dissector_oid_not_implemented = EI_INIT;
static expert_field ei_ros_unknown_ros_pdu = EI_INIT;
static dissector_table_t ros_oid_dissector_table=NULL;
-static GHashTable *oid_table=NULL;
-static GHashTable *protocol_table=NULL;
+static wmem_map_t *protocol_table=NULL;
void
register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_rtse)
{
dissector_add_string("ros.oid", oid, dissector);
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
if(!uses_rtse)
/* if we are not using RTSE, then we must register ROS with BER (ACSE) */
@@ -160,8 +155,7 @@ register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector,
void
register_ros_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name, gboolean uses_rtse)
{
- g_hash_table_insert(protocol_table, (gpointer)oid, (gpointer)rinfo);
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
+ wmem_map_insert(protocol_table, (gpointer)oid, (gpointer)rinfo);
if(!uses_rtse)
/* if we are not using RTSE, then we must register ROS with BER (ACSE) */
@@ -205,7 +199,7 @@ ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
proto_item *item=NULL;
proto_tree *ros_tree=NULL;
- if((session != NULL) && ((rinfo = (ros_info_t*)g_hash_table_lookup(protocol_table, oid)) != NULL)) {
+ if((session != NULL) && ((rinfo = (ros_info_t*)wmem_map_lookup(protocol_table, oid)) != NULL)) {
if(tree){
item = proto_tree_add_item(tree, *(rinfo->proto), tvb, 0, -1, ENC_NA);
@@ -334,9 +328,19 @@ static ros_call_response_t *
ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint invokeId, gboolean isInvoke)
{
ros_call_response_t rcr, *rcrp=NULL;
- ros_conv_info_t *ros_info = ros_info_items;
+ ros_conv_info_t *ros_info;
+ conversation_t *conversation;
/* first see if we have already matched this */
+ conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
+ pinfo->ptype, pinfo->srcport,
+ pinfo->destport, 0);
+ if (conversation == NULL)
+ return NULL;
+
+ ros_info = (ros_conv_info_t *)conversation_get_proto_data(conversation, proto_ros);
+ if (ros_info == NULL)
+ return NULL;
rcr.invokeId=invokeId;
rcr.is_request = isInvoke;
@@ -349,7 +353,7 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcr.rep_frame=pinfo->num;
}
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->matched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->matched, &rcr);
if(rcrp) {
/* we have found a match */
@@ -367,10 +371,10 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcr.invokeId=invokeId;
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->unmatched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->unmatched, &rcr);
if(rcrp){
- g_hash_table_remove(ros_info->unmatched, rcrp);
+ wmem_map_remove(ros_info->unmatched, rcrp);
}
/* if we can't reuse the old one, grab a new chunk */
@@ -382,7 +386,7 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
rcrp->req_time=pinfo->abs_ts;
rcrp->rep_frame=0;
rcrp->is_request=TRUE;
- g_hash_table_insert(ros_info->unmatched, rcrp, rcrp);
+ wmem_map_insert(ros_info->unmatched, rcrp, rcrp);
return NULL;
} else {
@@ -390,15 +394,15 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
/* this is a result - it should be in our unmatched list */
rcr.invokeId=invokeId;
- rcrp=(ros_call_response_t *)g_hash_table_lookup(ros_info->unmatched, &rcr);
+ rcrp=(ros_call_response_t *)wmem_map_lookup(ros_info->unmatched, &rcr);
if(rcrp){
if(!rcrp->rep_frame){
- g_hash_table_remove(ros_info->unmatched, rcrp);
+ wmem_map_remove(ros_info->unmatched, rcrp);
rcrp->rep_frame=pinfo->num;
rcrp->is_request=FALSE;
- g_hash_table_insert(ros_info->matched, rcrp, rcrp);
+ wmem_map_insert(ros_info->matched, rcrp, rcrp);
}
}
}
@@ -1008,7 +1012,7 @@ dissect_ros_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
/*--- End of included file: packet-ros-fn.c ---*/
-#line 373 "./asn1/ros/packet-ros-template.c"
+#line 377 "./asn1/ros/packet-ros-template.c"
/*
* Dissect ROS PDUs inside a PPDU.
@@ -1044,14 +1048,11 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
/* No. Attach that information to the conversation. */
- ros_info = (ros_conv_info_t *)g_malloc(sizeof(ros_conv_info_t));
- ros_info->matched=g_hash_table_new(ros_info_hash_matched, ros_info_equal_matched);
- ros_info->unmatched=g_hash_table_new(ros_info_hash_unmatched, ros_info_equal_unmatched);
+ ros_info = (ros_conv_info_t *)wmem_new0(wmem_file_scope(), ros_conv_info_t);
+ ros_info->matched=wmem_map_new(wmem_file_scope(), ros_info_hash_matched, ros_info_equal_matched);
+ ros_info->unmatched=wmem_map_new(wmem_file_scope(), ros_info_hash_unmatched, ros_info_equal_unmatched);
conversation_add_proto_data(conversation, proto_ros, ros_info);
-
- ros_info->next = ros_info_items;
- ros_info_items = ros_info;
}
item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA);
@@ -1075,29 +1076,6 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
return tvb_captured_length(tvb);
}
-static void
-ros_cleanup(void)
-{
- ros_conv_info_t *ros_info;
-
- /* Free up state attached to the ros_info structures */
- for (ros_info = ros_info_items; ros_info != NULL; ) {
- ros_conv_info_t *last;
-
- g_hash_table_destroy(ros_info->matched);
- ros_info->matched=NULL;
- g_hash_table_destroy(ros_info->unmatched);
- ros_info->unmatched=NULL;
-
- last = ros_info;
- ros_info = ros_info->next;
- g_free(last);
- }
-
- ros_info_items = NULL;
-
-}
-
/*--- proto_register_ros -------------------------------------------*/
void proto_register_ros(void) {
@@ -1230,7 +1208,7 @@ void proto_register_ros(void) {
"OBJECT_IDENTIFIER", HFILL }},
/*--- End of included file: packet-ros-hfarr.c ---*/
-#line 482 "./asn1/ros/packet-ros-template.c"
+#line 460 "./asn1/ros/packet-ros-template.c"
};
/* List of subtrees */
@@ -1260,7 +1238,7 @@ void proto_register_ros(void) {
&ett_ros_Code,
/*--- End of included file: packet-ros-ettarr.c ---*/
-#line 498 "./asn1/ros/packet-ros-template.c"
+#line 476 "./asn1/ros/packet-ros-template.c"
};
static ei_register_info ei[] = {
@@ -1280,10 +1258,7 @@ void proto_register_ros(void) {
expert_register_field_array(expert_ros, ei, array_length(ei));
ros_oid_dissector_table = register_dissector_table("ros.oid", "ROS OID Dissectors", proto_ros, FT_STRING, BASE_NONE);
- oid_table=g_hash_table_new(g_str_hash, g_str_equal);
- protocol_table=g_hash_table_new(g_str_hash, g_str_equal);
-
- register_cleanup_routine(ros_cleanup);
+ protocol_table = wmem_map_new(wmem_epan_scope(), wmem_str_hash, g_str_equal);
}
diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c
index a9f5051cb3..cb01c6068a 100644
--- a/epan/dissectors/packet-rtse.c
+++ b/epan/dissectors/packet-rtse.c
@@ -118,7 +118,6 @@ static expert_field ei_rtse_abstract_syntax = EI_INIT;
static dissector_table_t rtse_oid_dissector_table=NULL;
static dissector_handle_t rtse_handle = NULL;
-static GHashTable *oid_table=NULL;
static gint ett_rtse_unknown = -1;
static reassembly_table rtse_reassembly_table;
@@ -171,9 +170,6 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
if (ros_handle == NULL)
ros_handle = find_dissector("ros");
- /* save the name - but not used */
- g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
-
/* register RTSE with the BER (ACSE) */
register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
@@ -736,7 +732,7 @@ dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
/*--- End of included file: packet-rtse-fn.c ---*/
-#line 192 "./asn1/rtse/packet-rtse-template.c"
+#line 188 "./asn1/rtse/packet-rtse-template.c"
/*
* Dissect RTSE PDUs inside a PPDU.
@@ -998,7 +994,7 @@ void proto_register_rtse(void) {
NULL, HFILL }},
/*--- End of included file: packet-rtse-hfarr.c ---*/
-#line 353 "./asn1/rtse/packet-rtse-template.c"
+#line 349 "./asn1/rtse/packet-rtse-template.c"
};
/* List of subtrees */
@@ -1020,7 +1016,7 @@ void proto_register_rtse(void) {
&ett_rtse_CallingSSuserReference,
/*--- End of included file: packet-rtse-ettarr.c ---*/
-#line 362 "./asn1/rtse/packet-rtse-template.c"
+#line 358 "./asn1/rtse/packet-rtse-template.c"
};
static ei_register_info ei[] = {
@@ -1054,9 +1050,6 @@ void proto_register_rtse(void) {
" in the TCP protocol settings.", &rtse_reassemble);
rtse_oid_dissector_table = register_dissector_table("rtse.oid", "RTSE OID Dissectors", proto_rtse, FT_STRING, BASE_NONE);
- oid_table=g_hash_table_new(g_str_hash, g_str_equal);
-
-
}