emem -> wmem ("tshark -v" tested)

svn path=/trunk/; revision=51979
This commit is contained in:
Jörg Mayer 2013-09-12 20:25:51 +00:00
parent 934cc4526d
commit 1965ab5d3e
9 changed files with 46 additions and 40 deletions

View File

@ -31,6 +31,7 @@
#include <epan/packet.h>
#include <wsutil/crc32.h>
#include <epan/crc32-tvb.h>
#include <epan/wmem/wmem.h>
#include <epan/reassemble.h>
#include <epan/conversation.h>
@ -391,7 +392,7 @@ static void ts2_standard_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
/* XXX: Following fragmentation stuff should be separate from the GUI stuff ?? */
/* Get our stored fragmentation data or create one! */
if ( ! ( frag = (ts2_frag *)p_get_proto_data(pinfo->fd, proto_ts2, 0) ) ) {
frag = se_new(ts2_frag);
frag = wmem_new(wmem_file_scope(), ts2_frag);
frag->frag_num=0;
}
@ -696,7 +697,7 @@ static ts2_conversation* ts2_get_conversation(packet_info *pinfo)
}
else
{
conversation_data = se_new(ts2_conversation);
conversation_data = wmem_new(wmem_file_scope(), ts2_conversation);
conversation_data->last_inorder_server_frame=0; /* sequence number should never be zero so we can use this as an initial number */
conversation_data->last_inorder_client_frame=0;
conversation_data->server_port=pinfo->srcport;
@ -823,7 +824,7 @@ static gboolean ts2_add_checked_crc32(proto_tree *tree, int hf_item, tvbuff_t *t
gint len;
guint32 ocrc32;
zero = (guint8 *)ep_alloc0(4);
zero = (guint8 *)wmem_alloc0(wmem_packet_scope(), 4);
ocrc32 = crc32_ccitt_tvb(tvb, offset);
ocrc32 = crc32_ccitt_seed(zero, 4, 0xffffffff-ocrc32);
len = tvb_reported_length_remaining(tvb, offset+4);

View File

@ -53,6 +53,7 @@
#include <epan/packet.h>
#include <epan/address.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/strutil.h>
@ -4734,7 +4735,7 @@ dissect_structured_fields(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
}
/* Not found */
sf_id_str = ep_strdup_printf("Unknown [%0*x]", sf_id_len*2, sf_id);
sf_id_str = wmem_strdup_printf(wmem_packet_scope(), "Unknown [%0*x]", sf_id_len*2, sf_id);
display_sf_hdr(tn3270_tree, tvb, offset, sf_length,
sf_length, sf_id_len, sf_id_str);
offset += sf_length;
@ -5322,7 +5323,7 @@ add_tn3270_conversation(packet_info *pinfo, int tn3270e, gint model)
/* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
tn3270_info = se_new(tn3270_conv_info_t);
tn3270_info = wmem_new(wmem_file_scope(), tn3270_conv_info_t);
COPY_ADDRESS(&(tn3270_info->outbound_addr), &(pinfo->dst));
tn3270_info->outbound_port = pinfo->destport;

View File

@ -36,6 +36,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/address.h>
#include <wmem/wmem.h>
#include <epan/conversation.h>
#include "packet-tn5250.h"
@ -5149,7 +5150,7 @@ add_tn5250_conversation(packet_info *pinfo, int tn5250e)
/* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
tn5250_info = se_new(tn5250_conv_info_t);
tn5250_info = wmem_new(wmem_file_scope(), tn5250_conv_info_t);
SE_COPY_ADDRESS(&(tn5250_info->outbound_addr),&(pinfo->dst));
tn5250_info->outbound_port = pinfo->destport;
SE_COPY_ADDRESS(&(tn5250_info->inbound_addr),&(pinfo->src));

View File

@ -41,7 +41,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/stats_tree.h>
@ -1821,7 +1821,7 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
OT = 10 * OT + (tvb_get_guint8(tvb, UCP_OT_OFFSET + 1) - '0');
/* Create Tap record */
tap_rec = ep_new0(ucp_tap_rec_t);
tap_rec = wmem_new0(wmem_packet_scope(), ucp_tap_rec_t);
tap_rec->message_type = (O_R == 'O' ? 0 : 1);
tap_rec->operation = OT;

View File

@ -34,7 +34,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/addr_resolv.h>
#include <epan/ipproto.h>
#include <epan/in_cksum.h>
@ -175,7 +175,7 @@ init_udp_conversation_data(void)
struct udp_analysis *udpd;
/* Initialize the udp protocol data structure to add to the udp conversation */
udpd = se_new0(struct udp_analysis);
udpd = wmem_new0(wmem_file_scope(), struct udp_analysis);
/*
udpd->flow1.username = NULL;
udpd->flow1.command = NULL;
@ -263,8 +263,8 @@ add_udp_process_info(guint32 frame_num, address *local_addr, address *remote_add
flow->process_uid = uid;
flow->process_pid = pid;
flow->username = se_strdup(username);
flow->command = se_strdup(command);
flow->username = wmem_strdup(wmem_file_scope(), username);
flow->command = wmem_strdup(wmem_file_scope(), command);
}
@ -370,7 +370,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
struct udp_analysis *udpd = NULL;
proto_tree *process_tree;
udph=ep_new(e_udphdr);
udph=wmem_new(wmem_packet_scope(), e_udphdr);
SET_ADDRESS(&udph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data);
SET_ADDRESS(&udph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);

View File

@ -28,6 +28,7 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <glib.h>
#include <wsutil/crc7.h> /* For FP data header and control frame CRC. */
@ -3006,7 +3007,7 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto
for (pdu_no=0; pdu_no < subframes[n].number_of_mac_is_pdus; pdu_no++) {
int i;
guint length = 0;
umts_mac_is_info * mac_is_info = se_new(umts_mac_is_info);
umts_mac_is_info * mac_is_info = wmem_new(wmem_file_scope(), umts_mac_is_info);
mac_is_info->number_of_mac_is_sdus = subframes[n].number_of_mac_is_sdus[pdu_no];
DISSECTOR_ASSERT(subframes[n].number_of_mac_is_sdus[pdu_no] <= MAX_MAC_FRAMES);
@ -3821,7 +3822,7 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
guint8 fake_lchid=0;
gint *cur_val=NULL;
fpi = se_new0(fp_info);
fpi = wmem_new0(wmem_file_scope(), fp_info);
p_add_proto_data(pinfo->fd, proto_fp, 0, fpi);
fpi->iface_type = p_conv_data->iface_type;
@ -3859,14 +3860,14 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
switch (fpi->channel) {
case CHANNEL_HSDSCH: /* HS-DSCH - High Speed Downlink Shared Channel */
fpi->hsdsch_entity = p_conv_data->hsdsch_entity;
macinf = se_new0(umts_mac_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
fpi->hsdsch_macflowd_id = p_conv_data->hsdsch_macdflow_id;
macinf->content[0] = hsdsch_macdflow_id_mac_content_map[p_conv_data->hsdsch_macdflow_id]; /*MAC_CONTENT_PS_DTCH;*/
macinf->lchid[0] = p_conv_data->hsdsch_macdflow_id;
/*macinf->content[0] = lchId_type_table[p_conv_data->edch_lchId[0]];*/
p_add_proto_data(pinfo->fd, proto_umts_mac, 0, macinf);
rlcinf = se_new0(rlc_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
/*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then it's SRB0 == UM else AM*/
rlcinf->mode[0] = hsdsch_macdflow_id_rlc_map[p_conv_data->hsdsch_macdflow_id];
@ -3914,8 +3915,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
case CHANNEL_EDCH:
/*Most configuration is now done in the actual dissecting function*/
macinf = se_new0(umts_mac_info);
rlcinf = se_new0(rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
fpi->no_ddi_entries = p_conv_data->no_ddi_entries;
for (i=0; i<fpi->no_ddi_entries; i++) {
fpi->edch_ddi[i] = p_conv_data->edch_ddi[i]; /*Set the DDI value*/
@ -3927,7 +3928,7 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
}
fpi->edch_type = p_conv_data->edch_type;
/* macinf = se_new0(umts_mac_info);
/* macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
macinf->content[0] = MAC_CONTENT_PS_DTCH;*/
p_add_proto_data(pinfo->fd, proto_umts_mac, 0, macinf);
@ -3962,8 +3963,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
return fpi;
}
rlcinf = se_new0(rlc_info);
macinf = se_new0(umts_mac_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
offset = 2; /*To correctly read the tfi*/
fakes = 5; /* Reset fake counter. */
for (chan=0; chan < fpi->num_chans; chan++) { /*Iterate over the what channels*/
@ -4080,12 +4081,12 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
*/
offset = 2;
/* Set MAC data */
macinf = se_new0(umts_mac_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
macinf->ctmux[0] = 1;
macinf->content[0] = MAC_CONTENT_DCCH;
p_add_proto_data(pinfo->fd, proto_umts_mac, 0, macinf);
/* Set RLC data */
rlcinf = se_new0(rlc_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
/* Make configurable ?(avaliable in NBAP?) */
/* For RLC re-assembly to work we need to fake urnti */
rlcinf->urnti[0] = fpi->channel;
@ -4108,8 +4109,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
*/
offset = 2;
/* set MAC data */
macinf = se_new0(umts_mac_info);
rlcinf = se_new0(rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
for( chan = 0; chan < fpi->num_chans; chan++ ){
macinf->ctmux[chan] = 1;
macinf->content[chan] = MAC_CONTENT_DCCH;
@ -4122,8 +4123,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data,
p_add_proto_data(pinfo->fd, proto_rlc, 0, rlcinf);
break;
case CHANNEL_HSDSCH_COMMON:
rlcinf = se_new0(rlc_info);
macinf = se_new0(umts_mac_info);
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
p_add_proto_data(pinfo->fd, proto_umts_mac, 0, macinf);
p_add_proto_data(pinfo->fd, proto_rlc, 0, rlcinf);
break;

View File

@ -26,6 +26,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/prefs.h>
@ -466,7 +467,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
/* In this case skip RLC and call RRC immediately subdissector */
rrcinf = (rrc_info *)p_get_proto_data(pinfo->fd, proto_rrc, 0);
if (!rrcinf) {
rrcinf = se_new0(struct rrc_info);
rrcinf = wmem_new0(wmem_file_scope(), struct rrc_info);
p_add_proto_data(pinfo->fd, proto_rrc, 0, rrcinf);
}
rrcinf->msgtype[fpinf->cur_tb] = RRC_MESSAGE_TYPE_BCCH_FACH;
@ -604,7 +605,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
static void init_frag(tvbuff_t * tvb, body_parts * bp, guint length, guint offset, guint32 frame_num, guint16 tsn, guint8 type)
{
mac_is_fragment * frag = se_new(mac_is_fragment);
mac_is_fragment * frag = wmem_new(wmem_file_scope(), mac_is_fragment);
frag->type = type;
frag->length = length;
frag->data = (guint8 *)g_malloc(length);
@ -656,14 +657,14 @@ static tvbuff_t * reassemble(tvbuff_t * tvb, body_parts ** body_parts_array, gui
if (sdus == NULL) {
mac_is_channel * channel;
sdus = g_hash_table_new(mac_is_fragment_hash, mac_is_fragment_equal);
channel = se_new(mac_is_channel);
channel = wmem_new(wmem_file_scope(), mac_is_channel);
*channel = *ch;
g_hash_table_insert(mac_is_sdus, channel, sdus);
}
sdu = se_new(mac_is_sdu);
sdu = wmem_new(wmem_file_scope(), mac_is_sdu);
sdu->length = 0;
sdu->data = (guint8 *)se_alloc(length);
sdu->data = (guint8 *)wmem_alloc(wmem_file_scope(), length);
f = body_parts_array[head_tsn]->head; /* Start from head. */
g_hash_table_insert(sdus, f, sdu); /* Insert head->sdu mapping. */
@ -785,11 +786,11 @@ static body_parts ** get_body_parts(mac_is_channel * ch)
if (bpa == NULL) {
mac_is_channel * channel;
guint16 i;
bpa = se_alloc_array(body_parts*, MAX_TSN); /* Create new body_parts-pointer array */
bpa = wmem_alloc_array(wmem_file_scope(), body_parts*, MAX_TSN); /* Create new body_parts-pointer array */
for (i = 0; i < MAX_TSN; i++) {
bpa[i] = se_new0(body_parts); /* Fill it with body_parts. */
bpa[i] = wmem_new0(wmem_file_scope(), body_parts); /* Fill it with body_parts. */
}
channel = se_new(mac_is_channel); /* Alloc new channel for use in hash table. */
channel = wmem_new(wmem_file_scope(), mac_is_channel); /* Alloc new channel for use in hash table. */
*channel = *ch;
g_hash_table_insert(mac_is_fragments, channel, bpa);
}

View File

@ -30,7 +30,7 @@
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/uat.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#ifdef _MSC_VER
/* disable: warning C4090: 'XY' : different 'const' qualifiers */
@ -94,7 +94,8 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
item = proto_tree_add_item(tree,proto_user_encap,tvb,0,-1,ENC_NA);
if (!encap) {
char* msg = ep_strdup_printf("User encapsulation not handled: DLT=%d, "
char* msg = wmem_strdup_printf(wmem_packet_scope(),
"User encapsulation not handled: DLT=%d, "
"check your Preferences->Protocols->DLT_USER",
pinfo->match_uint + 147 - WTAP_ENCAP_USER0);
proto_item_set_text(item,"%s",msg);
@ -104,7 +105,8 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
return;
}
if (encap->payload_proto == NULL) {
char* msg = ep_strdup_printf("User encapsulation's protocol %s not found: "
char* msg = wmem_strdup_printf(wmem_packet_scope(),
"User encapsulation's protocol %s not found: "
"DLT=%d, check your Preferences->Protocols->DLT_USER",
encap->payload_proto_name,
pinfo->match_uint + 147 - WTAP_ENCAP_USER0);

View File

@ -31,7 +31,6 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#define SOH (0x01)
#define STX (0x02)