Skip to content

Commit

Permalink
Convert a batch of asn1 dissectors from emem to wmem.
Browse files Browse the repository at this point in the history
svn path=/trunk/; revision=50057
  • Loading branch information
eapache committed Jun 19, 2013
1 parent ab6d043 commit 9fa4a8e
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 41 deletions.
8 changes: 4 additions & 4 deletions asn1/acse/packet-acse-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
#include <epan/oids.h>
#include <epan/asn1.h>
Expand Down Expand Up @@ -125,9 +125,9 @@ static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
aco=se_alloc(sizeof(acse_ctx_oid_t));
aco=wmem_new(wmem_file_scope(), acse_ctx_oid_t);
aco->ctx_id=idx;
aco->oid=se_strdup(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);
Expand Down Expand Up @@ -186,7 +186,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if(session->spdu_type == 0 ) {
if(parent_tree){
REPORT_DISSECTOR_BUG(
ep_strdup_printf("Wrong spdu type %x from session dissector.",session->spdu_type));
wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type));
return ;
}
}
Expand Down
14 changes: 7 additions & 7 deletions asn1/ansi_tcap/packet-ansi_tcap-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/oids.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/asn1.h>
#include <epan/strutil.h>

Expand Down Expand Up @@ -197,13 +197,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
/* The hash string needs to contain src and dest to distiguish differnt flows */
switch(ansi_tcap_response_matching_type){
case 0:
buf = ep_strdup(ansi_tcap_private.TransactionID_str);
buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str);
break;
case 1:
buf = ep_strdup_printf("%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
break;
default:
buf = ep_strdup_printf("%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
break;
}

Expand All @@ -212,13 +212,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
if(ansi_tcap_saved_invokedata)
return;

ansi_tcap_saved_invokedata = se_new(struct ansi_tcap_invokedata_t);
ansi_tcap_saved_invokedata = wmem_new(wmem_file_scope(), struct ansi_tcap_invokedata_t);
ansi_tcap_saved_invokedata->OperationCode = ansi_tcap_private.d.OperationCode;
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,
se_strdup(buf),
wmem_strdup(wmem_file_scope(), buf),
ansi_tcap_saved_invokedata);
/*
g_warning("Tcap Invoke Hash string %s",buf);
Expand All @@ -238,7 +238,7 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
}

/* The hash string needs to contain src and dest to distiguish differnt flows */
buf = (char *)ep_alloc(MAX_TID_STR_LEN);
buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_TID_STR_LEN);
buf[0] = '\0';
/* Reverse order to invoke */
g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
Expand Down
4 changes: 2 additions & 2 deletions asn1/gsm_map/packet-gsm_map-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/tap.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/oids.h>
#include <epan/expert.h>

Expand Down Expand Up @@ -326,7 +326,7 @@ unpack_digits(tvbuff_t *tvb, int offset) {
length = tvb_length(tvb);
if (length < offset)
return "";
digit_str = (char *)ep_alloc((length - offset)*2+1);
digit_str = (char *)wmem_alloc(wmem_packet_scope(), (length - offset)*2+1);

while ( offset < length ){

Expand Down
14 changes: 7 additions & 7 deletions asn1/h245/packet-h245-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#include <epan/prefs.h>
#include <epan/t35.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/tap.h>
Expand Down Expand Up @@ -322,7 +322,7 @@ void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )

static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
{
return ep_strdup_printf("%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
}

static void update_unicast_addr(unicast_addr_t *req_addr, unicast_addr_t *ack_addr)
Expand Down Expand Up @@ -354,17 +354,17 @@ static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_cha

/* (S)RTP, (S)RTCP */
if (upcoming_channel_lcl->rfc2198 > 0) {
encoding_name_and_rate_t *encoding_name_and_rate = se_new(encoding_name_and_rate_t);
encoding_name_and_rate_t *encoding_name_and_rate = wmem_new(wmem_file_scope(), encoding_name_and_rate_t);
rtp_dyn_payload = g_hash_table_new(g_int_hash, g_int_equal);
encoding_name_and_rate->encoding_name = se_strdup("red");
encoding_name_and_rate->encoding_name = wmem_strdup(wmem_file_scope(), "red");
encoding_name_and_rate->sample_rate = 8000;
key = se_new(gint);
key = wmem_new(wmem_file_scope(), gint);
*key = upcoming_channel_lcl->rfc2198;
g_hash_table_insert(rtp_dyn_payload, key, encoding_name_and_rate);
}

if (upcoming_channel_lcl->srtp_flag) {
dummy_srtp_info = se_new0(struct srtp_info);
dummy_srtp_info = wmem_new0(wmem_file_scope(), struct srtp_info);
}

/* DEBUG g_warning("h245_setup_channels media_addr.addr.type %u port %u",upcoming_channel_lcl->media_addr.addr.type, upcoming_channel_lcl->media_addr.port );
Expand Down Expand Up @@ -432,7 +432,7 @@ dissect_h245_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* assume that whilst there is more tvb data, there are more h245 commands */
while ( tvb_length_remaining( tvb, offset>>3 )>0 ){
CLEANUP_PUSH(reset_h245_pi, NULL);
h245_pi=ep_new(h245_packet_info);
h245_pi=wmem_new(wmem_packet_scope(), h245_packet_info);
init_h245_packet_info(h245_pi);
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
offset = dissect_h245_MultimediaSystemControlMessage(tvb, offset, &asn1_ctx, tr, hf_h245_pdu_type);
Expand Down
1 change: 0 additions & 1 deletion asn1/kerberos/packet-kerberos-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#include <epan/strutil.h>

#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/asn1.h>
#include <epan/expert.h>
#include <epan/prefs.h>
Expand Down
8 changes: 4 additions & 4 deletions epan/dissectors/packet-acse.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
#include <epan/oids.h>
#include <epan/asn1.h>
Expand Down Expand Up @@ -286,9 +286,9 @@ static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
aco=se_alloc(sizeof(acse_ctx_oid_t));
aco=wmem_new(wmem_file_scope(), acse_ctx_oid_t);
aco->ctx_id=idx;
aco->oid=se_strdup(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);
Expand Down Expand Up @@ -1726,7 +1726,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if(session->spdu_type == 0 ) {
if(parent_tree){
REPORT_DISSECTOR_BUG(
ep_strdup_printf("Wrong spdu type %x from session dissector.",session->spdu_type));
wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type));
return ;
}
}
Expand Down
14 changes: 7 additions & 7 deletions epan/dissectors/packet-ansi_tcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/oids.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/asn1.h>
#include <epan/strutil.h>

Expand Down Expand Up @@ -288,13 +288,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
/* The hash string needs to contain src and dest to distiguish differnt flows */
switch(ansi_tcap_response_matching_type){
case 0:
buf = ep_strdup(ansi_tcap_private.TransactionID_str);
buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str);
break;
case 1:
buf = ep_strdup_printf("%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src));
break;
default:
buf = ep_strdup_printf("%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,ep_address_to_str(src),ep_address_to_str(dst));
break;
}

Expand All @@ -303,13 +303,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
if(ansi_tcap_saved_invokedata)
return;

ansi_tcap_saved_invokedata = se_new(struct ansi_tcap_invokedata_t);
ansi_tcap_saved_invokedata = wmem_new(wmem_file_scope(), struct ansi_tcap_invokedata_t);
ansi_tcap_saved_invokedata->OperationCode = ansi_tcap_private.d.OperationCode;
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,
se_strdup(buf),
wmem_strdup(wmem_file_scope(), buf),
ansi_tcap_saved_invokedata);
/*
g_warning("Tcap Invoke Hash string %s",buf);
Expand All @@ -329,7 +329,7 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U
}

/* The hash string needs to contain src and dest to distiguish differnt flows */
buf = (char *)ep_alloc(MAX_TID_STR_LEN);
buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_TID_STR_LEN);
buf[0] = '\0';
/* Reverse order to invoke */
g_snprintf(buf, MAX_TID_STR_LEN, "%s%s%s",
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/packet-gsm_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/tap.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/oids.h>
#include <epan/expert.h>

Expand Down Expand Up @@ -2522,7 +2522,7 @@ unpack_digits(tvbuff_t *tvb, int offset) {
length = tvb_length(tvb);
if (length < offset)
return "";
digit_str = (char *)ep_alloc((length - offset)*2+1);
digit_str = (char *)wmem_alloc(wmem_packet_scope(), (length - offset)*2+1);

while ( offset < length ){

Expand Down
14 changes: 7 additions & 7 deletions epan/dissectors/packet-h245.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#include <epan/prefs.h>
#include <epan/t35.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/tap.h>
Expand Down Expand Up @@ -453,7 +453,7 @@ void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )

static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
{
return ep_strdup_printf("%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
}

static void update_unicast_addr(unicast_addr_t *req_addr, unicast_addr_t *ack_addr)
Expand Down Expand Up @@ -485,17 +485,17 @@ static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_cha

/* (S)RTP, (S)RTCP */
if (upcoming_channel_lcl->rfc2198 > 0) {
encoding_name_and_rate_t *encoding_name_and_rate = se_new(encoding_name_and_rate_t);
encoding_name_and_rate_t *encoding_name_and_rate = wmem_new(wmem_file_scope(), encoding_name_and_rate_t);
rtp_dyn_payload = g_hash_table_new(g_int_hash, g_int_equal);
encoding_name_and_rate->encoding_name = se_strdup("red");
encoding_name_and_rate->encoding_name = wmem_strdup(wmem_file_scope(), "red");
encoding_name_and_rate->sample_rate = 8000;
key = se_new(gint);
key = wmem_new(wmem_file_scope(), gint);
*key = upcoming_channel_lcl->rfc2198;
g_hash_table_insert(rtp_dyn_payload, key, encoding_name_and_rate);
}

if (upcoming_channel_lcl->srtp_flag) {
dummy_srtp_info = se_new0(struct srtp_info);
dummy_srtp_info = wmem_new0(wmem_file_scope(), struct srtp_info);
}

/* DEBUG g_warning("h245_setup_channels media_addr.addr.type %u port %u",upcoming_channel_lcl->media_addr.addr.type, upcoming_channel_lcl->media_addr.port );
Expand Down Expand Up @@ -14527,7 +14527,7 @@ dissect_h245_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* assume that whilst there is more tvb data, there are more h245 commands */
while ( tvb_length_remaining( tvb, offset>>3 )>0 ){
CLEANUP_PUSH(reset_h245_pi, NULL);
h245_pi=ep_new(h245_packet_info);
h245_pi=wmem_new(wmem_packet_scope(), h245_packet_info);
init_h245_packet_info(h245_pi);
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
offset = dissect_h245_MultimediaSystemControlMessage(tvb, offset, &asn1_ctx, tr, hf_h245_pdu_type);
Expand Down

0 comments on commit 9fa4a8e

Please sign in to comment.