emem -> wmem

svn path=/trunk/; revision=52038
This commit is contained in:
Jörg Mayer 2013-09-14 14:33:04 +00:00
parent 7584f77567
commit f737cea032
11 changed files with 48 additions and 45 deletions

View File

@ -26,6 +26,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/prefs.h>
#include <epan/tap.h>
@ -529,7 +530,7 @@ dissect_sametime_content(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_append_str(pinfo->cinfo, COL_INFO, " ");
/* message type statistic */
sinfo = ep_new(struct SametimeTap);
sinfo = wmem_new(wmem_packet_scope(), struct SametimeTap);
sinfo->message_type = message_type;
sinfo->send_type = -1;
sinfo->user_status = -1;

View File

@ -26,6 +26,7 @@
#include "config.h"
#include <glib.h>
#include <epan/wmem/wmem.h>
#include <epan/packet.h>
#include <epan/expert.h>
#include "packet-tcp.h"
@ -527,7 +528,7 @@ static void dissect_dereg_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offse
proto_tree *dereg_req_data;
guint8 reason_flag;
static gboolean first_flag = TRUE;
emem_strbuf_t *reasonflags_strbuf = ep_strbuf_new_label("");
wmem_strbuf_t *reasonflags_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
static const gchar *fstr[] = {"No Reason", "Learned & Purposeful" };
dereg_tree = proto_tree_add_text(pay_load, tvb, offset, -1 , "DeReg Request");
@ -542,19 +543,19 @@ static void dissect_dereg_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offse
offset += 1;
/* Reason */
ep_strbuf_truncate(reasonflags_strbuf, 0);
wmem_strbuf_truncate(reasonflags_strbuf, 0);
reason_flag = tvb_get_guint8(tvb, offset);
if ((reason_flag & SASP_DEREG_REQ_REASON_LEARNED) == 0)
ep_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[0]);
wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[0]);
else
ep_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[1]);
wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[1]);
first_flag = FALSE;
/*dereg_req_reason_flag =*/
proto_tree_add_uint_format(dereg_req_data, hf_dereg_req_reason_flag, tvb,
offset, 1, reason_flag, "Reason: 0x%02x (%s)", reason_flag,
reasonflags_strbuf->str);
wmem_strbuf_get_str(reasonflags_strbuf));
#if 0 /* XXX: ToDo?? Flags to be displayed under a subtree ? */
dereg_req_reason_flag_tree = proto_item_add_subtree(dereg_req_reason_flag, ett_dereg_req_reason_flag);
#endif

View File

@ -28,7 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
/* Attribute values*/
@ -711,10 +711,10 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
sbus_attribut = tvb_get_guint8(tvb,8);
if ( !request_val && sbus_attribut == 0 ) {/* request telegram */
new_request_key = se_new(sbus_request_key);
new_request_key = wmem_new(wmem_file_scope(), sbus_request_key);
*new_request_key = request_key;
request_val = se_new(sbus_request_val);
request_val = wmem_new(wmem_file_scope(), sbus_request_val);
request_val->cmd_code=tvb_get_guint8(tvb,10);
request_val->retry_count=0;
request_val->req_frame = pinfo->fd->num; /*store actual frame nr.*/

View File

@ -85,7 +85,7 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/tap.h>
#include <epan/reassemble.h>
@ -5100,7 +5100,7 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo,
cmdset_t *csdata;
scsi_task_data_t *cdata;
cdata = ep_new(scsi_task_data_t);
cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
cdata->itl = itl;
cdata->itlq = itlq;
cdata->type = SCSI_PDU_TYPE_RSP;
@ -5160,7 +5160,7 @@ dissect_scsi_snsinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
const char *old_proto;
scsi_task_data_t *cdata;
cdata = ep_new(scsi_task_data_t);
cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
cdata->itl = itl;
cdata->itlq = itlq;
cdata->type = SCSI_PDU_TYPE_SNS;
@ -5505,7 +5505,7 @@ dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* make sure no one will overwrite this in the info column */
col_set_fence(pinfo->cinfo, COL_INFO);
cdata = ep_new(scsi_task_data_t);
cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
cdata->itl = itl;
cdata->itlq = itlq;
cdata->type = SCSI_PDU_TYPE_CDB;
@ -5586,7 +5586,7 @@ dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
payload_len = tvb_length(tvb);
cdata = ep_new(scsi_task_data_t);
cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
cdata->itl = itl;
cdata->itlq = itlq;
cdata->type = SCSI_PDU_TYPE_CDB;
@ -5783,7 +5783,7 @@ get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl)
cmdset = scsi_def_devtype;
}
csdata = ep_new(cmdset_t);
csdata = wmem_new(wmem_packet_scope(), cmdset_t);
switch(cmdset&SCSI_CMDSET_MASK) {
case SCSI_DEV_SBC:

View File

@ -29,19 +29,18 @@
#include <glib.h>
#include <epan/wmem/wmem.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/asn1.h>
#include <epan/conversation.h>
#include <epan/reassemble.h>
#include <epan/show_exception.h>
#include <epan/strutil.h>
#include "packet-ber.h"
#include "packet-ses.h"
/* #include <epan/prefs.h> */
#include <epan/emem.h>
#include <epan/strutil.h>
/* ses header fields */
static int proto_ses = -1;
@ -1092,7 +1091,7 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
pres_ctx_id = (guint32 *)p_get_proto_data (pinfo->fd, proto_ses, 0);
if (ses_rtse_reassemble != 0 && !pres_ctx_id) {
/* First time visited - save pres_ctx_id */
pres_ctx_id = se_new(guint32);
pres_ctx_id = wmem_new(wmem_file_scope(), guint32);
*pres_ctx_id = ses_pres_ctx_id;
p_add_proto_data (pinfo->fd, proto_ses, 0, pres_ctx_id);
}

View File

@ -35,7 +35,7 @@
#include <epan/packet.h>
#include <wiretap/wtap.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
static dissector_table_t sita_dissector_table;
static dissector_handle_t data_handle;
@ -75,27 +75,27 @@ static int hf_dcd = -1;
#define IOP "Local"
#define REMOTE "Remote"
static gchar *
static const gchar *
format_flags_string(guchar value, const gchar *array[])
{
int i;
guint bpos;
emem_strbuf_t *buf;
wmem_strbuf_t *buf;
const char *sep = "";
buf = ep_strbuf_sized_new(MAX_FLAGS_LEN, MAX_FLAGS_LEN);
buf = wmem_strbuf_sized_new(wmem_packet_scope(), MAX_FLAGS_LEN, MAX_FLAGS_LEN);
for (i = 0; i < 8; i++) {
bpos = 1 << i;
if (value & bpos) {
if (array[i][0]) {
/* there is a string to emit... */
ep_strbuf_append_printf(buf, "%s%s", sep,
wmem_strbuf_append_printf(buf, "%s%s", sep,
array[i]);
sep = ", ";
}
}
}
return buf->str;
return wmem_strbuf_get_str(buf);
}
static void
@ -103,7 +103,7 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
guchar flags, signals, errors1, errors2, proto;
gchar *errors1_string, *errors2_string, *signals_string, *flags_string;
const gchar *errors1_string, *errors2_string, *signals_string, *flags_string;
proto_tree *sita_tree = NULL;
proto_tree *sita_flags_tree = NULL;
proto_tree *sita_errors1_tree = NULL;

View File

@ -43,6 +43,7 @@
#include "config.h"
#include <glib.h>
#include <epan/wmem/wmem.h>
#include <epan/packet.h>
#include <epan/conversation.h>
@ -176,7 +177,7 @@ dissect_skype_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
skype_udp_info = (skype_udp_conv_info_t *)conversation_get_proto_data(conversation, proto_skype);
if (!skype_udp_info) {
/* new conversation create local data structure */
skype_udp_info = se_new(skype_udp_conv_info_t);
skype_udp_info = wmem_new(wmem_file_scope(), skype_udp_conv_info_t);
skype_udp_info->global_src_ip = 0;
skype_udp_info->global_dst_ip = 0;
conversation_add_proto_data(conversation, proto_skype,

View File

@ -62,7 +62,7 @@
#include <epan/stats_tree.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include "packet-tcp.h"
#include "packet-smpp.h"
@ -1555,7 +1555,7 @@ smpp_handle_tlv(proto_tree *tree, tvbuff_t *tvb, int *offset)
field = tvb_get_guint8(tvb, *offset);
minor = field & 0x0F;
major = (field & 0xF0) >> 4;
strval=ep_strdup_printf("%u.%u", major, minor);
strval=wmem_strdup_printf(wmem_packet_scope(), "%u.%u", major, minor);
proto_tree_add_string(sub_tree, hf_smpp_SC_interface_version,
tvb, *offset, 1, strval);
(*offset)++;
@ -1886,7 +1886,7 @@ bind_receiver(proto_tree *tree, tvbuff_t *tvb)
field = tvb_get_guint8(tvb, offset++);
minor = field & 0x0F;
major = (field & 0xF0) >> 4;
strval=ep_strdup_printf("%u.%u", major, minor);
strval=wmem_strdup_printf(wmem_packet_scope(), "%u.%u", major, minor);
proto_tree_add_string(tree, hf_smpp_interface_version, tvb,
offset - 1, 1, strval);
smpp_handle_int1(tree, tvb, hf_smpp_addr_ton, &offset);
@ -2464,8 +2464,8 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (command_status_str == NULL) {
/* Check if the reserved value is in the vendor-specific range. */
command_status_str = (command_status >= 0x400 && command_status <= 0x4FF ?
ep_strdup_printf("Vendor-specific Error (0x%08X)", command_status) :
ep_strdup_printf("(Reserved Error 0x%08X)", command_status));
wmem_strdup_printf(wmem_packet_scope(), "Vendor-specific Error (0x%08X)", command_status) :
wmem_strdup_printf(wmem_packet_scope(), "(Reserved Error 0x%08X)", command_status));
}
}
offset += 4;
@ -2719,7 +2719,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} /* if (tree || (command_id == 4)) */
/* Queue packet for Tap */
tap_rec = ep_new0(smpp_tap_rec_t);
tap_rec = wmem_new0(wmem_packet_scope(), smpp_tap_rec_t);
tap_rec->command_id = command_id;
tap_rec->command_status = command_status;
tap_queue_packet(smpp_tap, pinfo, tap_rec);

View File

@ -55,7 +55,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/sctpppids.h>
#include <epan/prefs.h>
#include <epan/expert.h>
@ -338,7 +338,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
global_data = (struct ssh_flow_data *)conversation_get_proto_data(conversation, proto_ssh);
if (!global_data) {
global_data = (struct ssh_flow_data *)se_alloc0(sizeof(struct ssh_flow_data));
global_data = (struct ssh_flow_data *)wmem_alloc0(wmem_file_scope(), sizeof(struct ssh_flow_data));
global_data->version=SSH_VERSION_UNKNOWN;
global_data->kex_specific_dissector=ssh_dissect_kex_dh;
global_data->peer_data[CLIENT_PEER_DATA].mac_length=-1;
@ -439,26 +439,26 @@ ssh_dissect_ssh2(tvbuff_t *tvb, packet_info *pinfo,
struct ssh_peer_data *peer_data = &global_data->peer_data[is_response];
if (tree) {
emem_strbuf_t *title=ep_strbuf_new("SSH Version 2");
wmem_strbuf_t *title=wmem_strbuf_new(wmem_packet_scope(), "SSH Version 2");
if (peer_data->enc || peer_data->mac || peer_data->comp) {
ep_strbuf_append_printf(title, " (");
wmem_strbuf_append_printf(title, " (");
if (peer_data->enc)
ep_strbuf_append_printf(title, "encryption:%s%s",
wmem_strbuf_append_printf(title, "encryption:%s%s",
peer_data->enc,
peer_data->mac || peer_data->comp
? " " : "");
if (peer_data->mac)
ep_strbuf_append_printf(title, "mac:%s%s",
wmem_strbuf_append_printf(title, "mac:%s%s",
peer_data->mac,
peer_data->comp ? " " : "");
if (peer_data->comp)
ep_strbuf_append_printf(title, "compression:%s",
wmem_strbuf_append_printf(title, "compression:%s",
peer_data->comp);
ep_strbuf_append_printf(title, ")");
wmem_strbuf_append_printf(title, ")");
}
ti=proto_tree_add_text(tree, tvb, offset, -1, "%s", title->str);
ti=proto_tree_add_text(tree, tvb, offset, -1, "%s", wmem_strbuf_get_str(title));
ssh2_tree = proto_item_add_subtree(ti, ett_ssh2);
}
@ -984,7 +984,7 @@ ssh_choose_algo(gchar *client, gchar *server, gchar **result)
for (step = client_strings; *step; step++) {
GSList *agreed;
if ((agreed=g_slist_find_custom(server_list, *step, ssh_gslist_compare_strings))) {
*result = se_strdup((const gchar *)agreed->data);
*result = wmem_strdup(wmem_file_scope(), (const gchar *)agreed->data);
break;
}
}

View File

@ -96,6 +96,7 @@
#include <epan/conversation.h>
#include <epan/reassemble.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/asn1.h>

View File

@ -25,7 +25,7 @@
#include <glib.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
#include <epan/packet.h>
#include <epan/reassemble.h>
@ -954,7 +954,7 @@ dissect_digitech_procedure(guint8 procedure, const gint offset,
if (conv_data == NULL)
{
conv_data = se_new(digitech_conv_data_t);
conv_data = wmem_new(wmem_file_scope(), digitech_conv_data_t);
conv_data->protocol_version = 1; /* Default to version 1 */
}