Convert another 10 dissectors to wmem.

svn path=/trunk/; revision=51612
This commit is contained in:
Evan Huus 2013-08-31 14:32:01 +00:00
parent dba0ceff0e
commit 58804a6f15
10 changed files with 115 additions and 119 deletions

View File

@ -507,7 +507,7 @@ typedef struct _adwin_transaction_t {
/* response/request tracking */
typedef struct _adwin_conv_info_t {
emem_tree_t *pdus;
wmem_tree_t *pdus;
} adwin_conv_info_t;
typedef enum { ADWIN_REQUEST,
@ -536,28 +536,27 @@ adwin_request_response_handling(tvbuff_t *tvb, packet_info *pinfo,
* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
adwin_info = se_new(adwin_conv_info_t);
adwin_info->pdus = se_tree_create_non_persistent(
EMEM_TREE_TYPE_RED_BLACK, "adwin_pdus");
adwin_info = wmem_new(wmem_file_scope(), adwin_conv_info_t);
adwin_info->pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_adwin, adwin_info);
}
if (!pinfo->fd->flags.visited) {
if (direction == ADWIN_REQUEST) {
/* This is a request */
adwin_trans = se_new(adwin_transaction_t);
adwin_trans = wmem_new(wmem_file_scope(), adwin_transaction_t);
adwin_trans->req_frame = pinfo->fd->num;
adwin_trans->rep_frame = 0;
adwin_trans->req_time = pinfo->fd->abs_ts;
se_tree_insert32(adwin_info->pdus, seq_num, (void *)adwin_trans);
wmem_tree_insert32(adwin_info->pdus, seq_num, (void *)adwin_trans);
} else {
adwin_trans = (adwin_transaction_t *)se_tree_lookup32(adwin_info->pdus, seq_num);
adwin_trans = (adwin_transaction_t *)wmem_tree_lookup32(adwin_info->pdus, seq_num);
if (adwin_trans) {
adwin_trans->rep_frame = pinfo->fd->num;
}
}
} else {
adwin_trans = (adwin_transaction_t *)se_tree_lookup32(adwin_info->pdus, seq_num);
adwin_trans = (adwin_transaction_t *)wmem_tree_lookup32(adwin_info->pdus, seq_num);
}
if (!adwin_trans) {
/* create a "fake" adwin_trans structure */

View File

@ -29,7 +29,7 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
void proto_register_ctdb(void);
void proto_reg_handoff_ctdb(void);
@ -81,7 +81,7 @@ static gint ett_ctdb_key = -1;
static expert_field ei_ctdb_too_many_nodes = EI_INIT;
/* this tree keeps track of caller/reqid for ctdb transactions */
static emem_tree_t *ctdb_transactions=NULL;
static wmem_tree_t *ctdb_transactions=NULL;
typedef struct _ctdb_trans_t {
guint32 key_hash;
guint32 request_in;
@ -90,7 +90,7 @@ typedef struct _ctdb_trans_t {
} ctdb_trans_t;
/* this tree keeps track of CONTROL request/responses */
static emem_tree_t *ctdb_controls=NULL;
static wmem_tree_t *ctdb_controls=NULL;
typedef struct _ctdb_control_t {
guint32 opcode;
guint32 request_in;
@ -578,7 +578,7 @@ static int
dissect_ctdb_reply_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 reqid, guint32 dst, int endianess)
{
guint32 datalen, keylen;
emem_tree_key_t tkey[3];
wmem_tree_key_t tkey[3];
ctdb_trans_t *ctdb_trans;
/* dbid */
@ -621,7 +621,7 @@ dissect_ctdb_reply_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pr
tkey[1].length=1;
tkey[1].key=&dst;
tkey[2].length=0;
ctdb_trans=(ctdb_trans_t *)se_tree_lookup32_array(ctdb_transactions, &tkey[0]);
ctdb_trans=(ctdb_trans_t *)wmem_tree_lookup32_array(ctdb_transactions, &tkey[0]);
if(ctdb_trans){
ctdb_trans->response_in=pinfo->fd->num;
@ -635,7 +635,7 @@ static int
dissect_ctdb_req_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 reqid, int endianess)
{
guint32 keylen, datalen, dmaster;
emem_tree_key_t tkey[3];
wmem_tree_key_t tkey[3];
ctdb_trans_t *ctdb_trans;
/* dbid */
@ -687,7 +687,7 @@ dissect_ctdb_req_dmaster(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
tkey[1].length=1;
tkey[1].key=&dmaster;
tkey[2].length=0;
ctdb_trans=(ctdb_trans_t *)se_tree_lookup32_array(ctdb_transactions, &tkey[0]);
ctdb_trans=(ctdb_trans_t *)wmem_tree_lookup32_array(ctdb_transactions, &tkey[0]);
if(ctdb_trans){
ctdb_display_trans(pinfo, tree, tvb, ctdb_trans);
@ -751,9 +751,9 @@ dissect_ctdb_req_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
/* setup request/response matching */
if(!pinfo->fd->flags.visited){
emem_tree_key_t tkey[4];
wmem_tree_key_t tkey[4];
ctdb_control=se_new(ctdb_control_t);
ctdb_control=wmem_new(wmem_file_scope(), ctdb_control_t);
ctdb_control->opcode=opcode;
ctdb_control->request_in=pinfo->fd->num;
ctdb_control->response_in=0;
@ -766,9 +766,9 @@ dissect_ctdb_req_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
tkey[2].key=&dst;
tkey[3].length=0;
se_tree_insert32_array(ctdb_controls, &tkey[0], ctdb_control);
wmem_tree_insert32_array(ctdb_controls, &tkey[0], ctdb_control);
} else {
emem_tree_key_t tkey[4];
wmem_tree_key_t tkey[4];
tkey[0].length=1;
tkey[0].key=&reqid;
@ -777,7 +777,7 @@ dissect_ctdb_req_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
tkey[2].length=1;
tkey[2].key=&dst;
tkey[3].length=0;
ctdb_control=(ctdb_control_t *)se_tree_lookup32_array(ctdb_controls, &tkey[0]);
ctdb_control=(ctdb_control_t *)wmem_tree_lookup32_array(ctdb_controls, &tkey[0]);
}
@ -795,7 +795,7 @@ static int
dissect_ctdb_reply_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 reqid, guint32 src, guint32 dst, int endianess)
{
ctdb_control_t *ctdb_control;
emem_tree_key_t tkey[4];
wmem_tree_key_t tkey[4];
proto_item *item;
guint32 datalen, errorlen, status;
int data_offset;
@ -808,7 +808,7 @@ dissect_ctdb_reply_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pr
tkey[2].length=1;
tkey[2].key=&src;
tkey[3].length=0;
ctdb_control=(ctdb_control_t *)se_tree_lookup32_array(ctdb_controls, &tkey[0]);
ctdb_control=(ctdb_control_t *)wmem_tree_lookup32_array(ctdb_controls, &tkey[0]);
if(!ctdb_control){
return offset;
@ -941,9 +941,9 @@ dissect_ctdb_req_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
/* setup request/response matching */
if(!pinfo->fd->flags.visited){
emem_tree_key_t tkey[3];
wmem_tree_key_t tkey[3];
ctdb_trans=se_new(ctdb_trans_t);
ctdb_trans=wmem_new(wmem_file_scope(), ctdb_trans_t);
ctdb_trans->key_hash=keyhash;
ctdb_trans->request_in=pinfo->fd->num;
ctdb_trans->response_in=0;
@ -954,16 +954,16 @@ dissect_ctdb_req_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
tkey[1].key=&caller;
tkey[2].length=0;
se_tree_insert32_array(ctdb_transactions, &tkey[0], ctdb_trans);
wmem_tree_insert32_array(ctdb_transactions, &tkey[0], ctdb_trans);
} else {
emem_tree_key_t tkey[3];
wmem_tree_key_t tkey[3];
tkey[0].length=1;
tkey[0].key=&reqid;
tkey[1].length=1;
tkey[1].key=&caller;
tkey[2].length=0;
ctdb_trans=(ctdb_trans_t *)se_tree_lookup32_array(ctdb_transactions, &tkey[0]);
ctdb_trans=(ctdb_trans_t *)wmem_tree_lookup32_array(ctdb_transactions, &tkey[0]);
}
if(ctdb_trans){
@ -1234,6 +1234,9 @@ proto_register_ctdb(void)
proto_register_subtree_array(ett, array_length(ett));
expert_ctdb = expert_register_protocol(proto_ctdb);
expert_register_field_array(expert_ctdb, ei, array_length(ei));
ctdb_transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
ctdb_controls = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
}
@ -1246,7 +1249,4 @@ proto_reg_handoff_ctdb(void)
dissector_add_handle("tcp.port", ctdb_handle);
heur_dissector_add("tcp", dissect_ctdb, proto_ctdb);
ctdb_transactions=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "CTDB transactions tree");
ctdb_controls=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "CTDB controls tree");
}

View File

@ -27,7 +27,7 @@
#include <glib.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/etypes.h>
@ -92,7 +92,7 @@ static gint ett_fcp_taskmgmt = -1;
static gint ett_fcp_rsp_flags = -1;
typedef struct _fcp_conv_data_t {
emem_tree_t *luns;
wmem_tree_t *luns;
} fcp_conv_data_t;
typedef struct fcp_request_data {
@ -429,21 +429,21 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
fchdr->itlq->lun = lun;
if (!pinfo->fd->flags.visited) {
proto_data = se_new(fcp_proto_data_t);
proto_data = wmem_new(wmem_file_scope(), fcp_proto_data_t);
proto_data->lun = lun;
p_add_proto_data(pinfo->fd, proto_fcp, 0, proto_data);
}
request_data = (fcp_request_data_t*)se_tree_lookup32(fcp_conv_data->luns, lun);
request_data = (fcp_request_data_t*)wmem_tree_lookup32(fcp_conv_data->luns, lun);
if (!request_data) {
request_data = se_new(fcp_request_data_t);
request_data = wmem_new(wmem_file_scope(), fcp_request_data_t);
request_data->request_frame = pinfo->fd->num;
request_data->response_frame = 0;
request_data->request_time = pinfo->fd->abs_ts;
request_data->itl = se_new(itl_nexus_t);
request_data->itl = wmem_new(wmem_file_scope(), itl_nexus_t);
request_data->itl->cmdset = 0xff;
request_data->itl->conversation = conversation;
se_tree_insert32(fcp_conv_data->luns, lun, request_data);
wmem_tree_insert32(fcp_conv_data->luns, lun, request_data);
}
proto_tree_add_item(tree, hf_fcp_crn, tvb, offset+8, 1, ENC_BIG_ENDIAN);
@ -703,8 +703,8 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fcp_conv_data = (fcp_conv_data_t *)conversation_get_proto_data(fc_conv, proto_fcp);
}
if (!fcp_conv_data) {
fcp_conv_data = se_new(fcp_conv_data_t);
fcp_conv_data->luns = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "FCP Luns");
fcp_conv_data = wmem_new(wmem_file_scope(), fcp_conv_data_t);
fcp_conv_data->luns = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(fc_conv, proto_fcp, fcp_conv_data);
}
@ -712,7 +712,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
The only way that consistently works is to save the lun on the first pass when packets
are guaranteed to be parsed consecutively */
if (!pinfo->fd->flags.visited) {
proto_data = se_new(fcp_proto_data_t);
proto_data = wmem_new(wmem_file_scope(), fcp_proto_data_t);
proto_data->lun = fchdr->itlq->lun;
p_add_proto_data(pinfo->fd, proto_fcp, 0, proto_data);
} else {
@ -721,7 +721,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if ((r_ctl != FCP_IU_CMD) && (r_ctl != FCP_IU_UNSOL_CTL)) {
request_data = (fcp_request_data_t *)se_tree_lookup32(fcp_conv_data->luns, fchdr->itlq->lun);
request_data = (fcp_request_data_t *)wmem_tree_lookup32(fcp_conv_data->luns, fchdr->itlq->lun);
}
/* put a request_in in all frames except the command frame */

View File

@ -31,7 +31,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/to_str.h>
#include <epan/prefs.h>
#include <epan/addr_resolv.h>
@ -96,7 +96,7 @@ struct ipmi_keyhead {
};
struct ipmi_keytree {
emem_tree_t *heads;
wmem_tree_t *heads;
};
struct ipmi_parse_typelen {
@ -184,7 +184,7 @@ key_lookup_reqresp(struct ipmi_keyhead *kh, struct ipmi_header *hdr, frame_data
guint8 is_resp = hdr->netfn & 0x01;
int i;
/* Source/target SA/LUN and sequence number are assumed to match; se_tree*
/* Source/target SA/LUN and sequence number are assumed to match; wmem_tree*
ensure that. While checking for "being here", we can't rely on flags.visited,
as we may have more than one IPMI message in a single frame. */
for (rr = kh->rr; rr; rr = rr->next) {
@ -349,9 +349,8 @@ maybe_insert_reqresp(packet_info *pinfo, ipmi_dissect_format_t *dfmt, struct ipm
kt = (struct ipmi_keytree *)conversation_get_proto_data(cnv, proto_ipmi);
if (!kt) {
kt = se_new(struct ipmi_keytree);
kt->heads = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
"ipmi_key_heads");
kt = wmem_new(wmem_file_scope(), struct ipmi_keytree);
kt->heads = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(cnv, proto_ipmi, kt);
}
@ -362,10 +361,10 @@ maybe_insert_reqresp(packet_info *pinfo, ipmi_dissect_format_t *dfmt, struct ipm
hdr->trg_sa, hdr->trg_lun, hdr->src_sa, hdr->src_lun, hdr->seq,
hdr->netfn, hdr->cmd);
key = makekey(hdr);
kh = (struct ipmi_keyhead *)se_tree_lookup32(kt->heads, key);
kh = (struct ipmi_keyhead *)wmem_tree_lookup32(kt->heads, key);
if (!kh) {
kh = se_new0(struct ipmi_keyhead);
se_tree_insert32(kt->heads, key, kh);
kh = wmem_new0(wmem_file_scope(), struct ipmi_keyhead);
wmem_tree_insert32(kt->heads, key, kh);
}
if ((rr = key_lookup_reqresp(kh, hdr, pinfo->fd)) != NULL) {
/* Already recorded - set frame number and be done. Look no
@ -393,9 +392,9 @@ maybe_insert_reqresp(packet_info *pinfo, ipmi_dissect_format_t *dfmt, struct ipm
/* Not found; allocate new structures */
if (!current_saved_data) {
/* One 'ipmi_saved_data' for all 'ipmi_req_resp' allocated */
current_saved_data = se_new0(struct ipmi_saved_data);
current_saved_data = wmem_new0(wmem_file_scope(), struct ipmi_saved_data);
}
rr = se_new0(struct ipmi_reqresp);
rr = wmem_new0(wmem_file_scope(), struct ipmi_reqresp);
rr->whichresponse = dfmt->whichresponse;
rr->netfn = hdr->netfn & 0x3e;
rr->cmd = hdr->cmd;
@ -452,7 +451,7 @@ add_reqresp_info(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr, proto_tre
hdr->trg_sa, hdr->trg_lun, hdr->src_sa, hdr->src_lun, hdr->seq,
hdr->netfn, hdr->cmd);
key = makekey(hdr);
if ((kh = (struct ipmi_keyhead *)se_tree_lookup32(kt->heads, key)) != NULL &&
if ((kh = (struct ipmi_keyhead *)wmem_tree_lookup32(kt->heads, key)) != NULL &&
(rr = key_lookup_reqresp(kh, hdr, pinfo->fd)) != NULL) {
debug_printf("Found [ <%d,%d,%d> (%02x,%1x <-> %02x,%1x : %02x) %02x %02x ]\n",
rr->frames[0].num, rr->frames[1].num, rr->frames[2].num,
@ -735,7 +734,7 @@ ipmi_add_typelen(proto_tree *tree, const char *desc, tvbuff_t *tvb,
len = typelen & msk;
ptr->get_len(&clen, &blen, tvb, offs + 1, len, is_fru);
str = (char *)ep_alloc(clen + 1);
str = (char *)wmem_alloc(wmem_packet_scope(), clen + 1);
ptr->parse(str, tvb, offs + 1, clen);
str[clen] = '\0';
@ -853,7 +852,7 @@ ipmi_getnetfnname(guint32 netfn, ipmi_netfn_t *nf)
ipmi_cmd_tab[netfn >> 1].desc : "Reserved";
db = nf ? nf->desc : NULL;
if (db) {
return ep_strdup_printf("%s (%s)", db, dn);
return wmem_strdup_printf(wmem_packet_scope(), "%s (%s)", db, dn);
} else {
return dn;
}

View File

@ -41,7 +41,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/prefs.h>
@ -588,7 +588,7 @@ typedef struct mysql_conn_data {
mysql_state_t state;
guint16 stmt_num_params;
guint16 stmt_num_fields;
emem_tree_t* stmts;
wmem_tree_t* stmts;
#ifdef CTDEBUG
guint32 generation;
#endif
@ -705,12 +705,12 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* get associated state information, create if necessary */
conn_data= (mysql_conn_data_t *)conversation_get_proto_data(conversation, proto_mysql);
if (!conn_data) {
conn_data= se_new(mysql_conn_data_t);
conn_data= wmem_new(wmem_file_scope(), mysql_conn_data_t);
conn_data->srv_caps= 0;
conn_data->clnt_caps= 0;
conn_data->clnt_caps_ext= 0;
conn_data->state= UNDEFINED;
conn_data->stmts= se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "PROTO_mysql_stmts");
conn_data->stmts= wmem_tree_new(wmem_file_scope());
#ifdef CTDEBUG
conn_data->generation= 0;
#endif
@ -724,7 +724,7 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* conversation now so if/when we dissect the frame again
* we'll start with the same state.
*/
mysql_frame_data_p = se_new(struct mysql_frame_data);
mysql_frame_data_p = wmem_new(wmem_file_scope(), struct mysql_frame_data);
mysql_frame_data_p->state = conn_data->state;
p_add_proto_data(pinfo->fd, proto_mysql, 0, mysql_frame_data_p);
@ -1314,7 +1314,7 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset,
stmt_id = tvb_get_letohl(tvb, offset);
offset += 4;
stmt_data = (my_stmt_data_t *)se_tree_lookup32(conn_data->stmts, stmt_id);
stmt_data = (my_stmt_data_t *)wmem_tree_lookup32(conn_data->stmts, stmt_id);
if (stmt_data != NULL) {
guint16 data_param = tvb_get_letohs(tvb, offset);
if (stmt_data->nparam > data_param) {
@ -1349,7 +1349,7 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset,
proto_tree_add_item(req_tree, hf_mysql_exec_iter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
stmt_data = (my_stmt_data_t *)se_tree_lookup32(conn_data->stmts, stmt_id);
stmt_data = (my_stmt_data_t *)wmem_tree_lookup32(conn_data->stmts, stmt_id);
if (stmt_data != NULL) {
if (stmt_data->nparam != 0) {
guint8 stmt_bound;
@ -1844,12 +1844,12 @@ mysql_dissect_response_prepare(tvbuff_t *tvb, int offset, proto_tree *tree, mysq
offset += 2;
proto_tree_add_item(tree, hf_mysql_num_params, tvb, offset, 2, ENC_LITTLE_ENDIAN);
conn_data->stmt_num_params = tvb_get_letohs(tvb, offset);
stmt_data = se_new(struct my_stmt_data);
stmt_data = wmem_new(wmem_file_scope(), struct my_stmt_data);
stmt_data->nparam = conn_data->stmt_num_params;
flagsize = (int)(sizeof(guint8) * stmt_data->nparam);
stmt_data->param_flags = (guint8 *)se_alloc(flagsize);
stmt_data->param_flags = (guint8 *)wmem_alloc(wmem_file_scope(), flagsize);
memset(stmt_data->param_flags, 0, flagsize);
se_tree_insert32(conn_data->stmts, stmt_id, stmt_data);
wmem_tree_insert32(conn_data->stmts, stmt_id, stmt_data);
offset += 2;
/* Filler */
offset += 1;

View File

@ -34,7 +34,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#if 0
#define PANA_UDP_PORT 3001
@ -207,7 +207,7 @@ typedef struct _pana_transaction_t {
} pana_transaction_t;
typedef struct _pana_conv_info_t {
emem_tree_t *pdus;
wmem_tree_t *pdus;
} pana_conv_info_t;
static void
@ -544,8 +544,8 @@ dissect_pana_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
pana_info = se_new(pana_conv_info_t);
pana_info->pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "pana_pdus");
pana_info = wmem_new(wmem_file_scope(), pana_conv_info_t);
pana_info->pdus=wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_pana, pana_info);
}
@ -553,24 +553,24 @@ dissect_pana_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(!pinfo->fd->flags.visited){
if(flags&PANA_FLAG_R){
/* This is a request */
pana_trans=se_new(pana_transaction_t);
pana_trans=wmem_new(wmem_file_scope(), pana_transaction_t);
pana_trans->req_frame=pinfo->fd->num;
pana_trans->rep_frame=0;
pana_trans->req_time=pinfo->fd->abs_ts;
se_tree_insert32(pana_info->pdus, seq_num, (void *)pana_trans);
wmem_tree_insert32(pana_info->pdus, seq_num, (void *)pana_trans);
} else {
pana_trans=(pana_transaction_t *)se_tree_lookup32(pana_info->pdus, seq_num);
pana_trans=(pana_transaction_t *)wmem_tree_lookup32(pana_info->pdus, seq_num);
if(pana_trans){
pana_trans->rep_frame=pinfo->fd->num;
}
}
} else {
pana_trans=(pana_transaction_t *)se_tree_lookup32(pana_info->pdus, seq_num);
pana_trans=(pana_transaction_t *)wmem_tree_lookup32(pana_info->pdus, seq_num);
}
if(!pana_trans){
/* create a "fake" pana_trans structure */
pana_trans=ep_new(pana_transaction_t);
pana_trans=wmem_new(wmem_packet_scope(), pana_transaction_t);
pana_trans->req_frame=0;
pana_trans->rep_frame=0;
pana_trans->req_time=pinfo->fd->abs_ts;

View File

@ -33,6 +33,7 @@
#include <epan/expert.h>
#include <epan/tap.h>
#include <epan/exported_pdu.h>
#include <epan/wmem/wmem.h>
#include <packet-tcp.h>
/* Initialize the protocol and registered fields */
@ -64,7 +65,7 @@ typedef struct _reload_frame_t {
/* Structure containing conversation specific information */
typedef struct _reload_frame_conv_info_t {
emem_tree_t *transaction_pdus;
wmem_tree_t *transaction_pdus;
} reload_conv_info_t;
@ -116,7 +117,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_tree *reload_framing_tree;
guint32 relo_token;
guint32 message_length = 0;
emem_tree_key_t transaction_id_key[4];
wmem_tree_key_t transaction_id_key[4];
guint32 *key_save, len_save;
guint32 sequence;
guint effective_length;
@ -195,7 +196,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
transaction_id_key[0].length = 1;
transaction_id_key[0].key = &sequence; /* sequence number */
/* When the se_tree_* functions iterate through the keys, they
/* When the wmem_tree_* functions iterate through the keys, they
* perform pointer arithmetic with guint32s, so we have to divide
* our length fields by that to make things work, but we still want
* to g_malloc and memcpy the entire amounts, since those both operate
@ -233,22 +234,21 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* No. Attach that information to the conversation, and add
* it to the list of information structures.
*/
reload_framing_info = se_new(reload_conv_info_t);
reload_framing_info->transaction_pdus = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
"reload_framing_transaction_pdus");
reload_framing_info = wmem_new(wmem_file_scope(), reload_conv_info_t);
reload_framing_info->transaction_pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_reload_framing, reload_framing_info);
}
if (!pinfo->fd->flags.visited) {
if ((reload_frame = (reload_frame_t *)
se_tree_lookup32_array(reload_framing_info->transaction_pdus, transaction_id_key)) == NULL) {
wmem_tree_lookup32_array(reload_framing_info->transaction_pdus, transaction_id_key)) == NULL) {
transaction_id_key[2].key = key_save;
transaction_id_key[2].length = len_save;
reload_frame = se_new(reload_frame_t);
reload_frame = wmem_new(wmem_file_scope(), reload_frame_t);
reload_frame->data_frame = 0;
reload_frame->ack_frame = 0;
reload_frame->req_time = pinfo->fd->abs_ts;
se_tree_insert32_array(reload_framing_info->transaction_pdus, transaction_id_key, (void *)reload_frame);
wmem_tree_insert32_array(reload_framing_info->transaction_pdus, transaction_id_key, (void *)reload_frame);
}
transaction_id_key[2].key = key_save;
transaction_id_key[2].length = len_save;
@ -269,7 +269,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
}
}
else {
reload_frame=(reload_frame_t *)se_tree_lookup32_array(reload_framing_info->transaction_pdus, transaction_id_key);
reload_frame=(reload_frame_t *)wmem_tree_lookup32_array(reload_framing_info->transaction_pdus, transaction_id_key);
transaction_id_key[2].key = key_save;
transaction_id_key[2].length = len_save;
}
@ -277,7 +277,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (!reload_frame) {
/* create a "fake" pana_trans structure */
reload_frame = ep_new(reload_frame_t);
reload_frame = wmem_new(wmem_packet_scope(), reload_frame_t);
reload_frame->data_frame = (type==DATA) ? pinfo->fd->num : 0;
reload_frame->ack_frame = (type!=DATA) ? pinfo->fd->num : 0;
reload_frame->req_time = pinfo->fd->abs_ts;

View File

@ -67,7 +67,7 @@
#include <epan/tap.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/strutil.h>
/* uncomment this to enable debugging of fragment reassembly */
@ -94,7 +94,7 @@ typedef struct _rtp_private_conv_info {
/* This tree is indexed by sequence number and keeps track of all
* all pdus spanning multiple segments for this flow.
*/
emem_tree_t *multisegment_pdus;
wmem_tree_t *multisegment_pdus;
} rtp_private_conv_info;
static reassembly_table rtp_reassembly_table;
@ -864,15 +864,15 @@ srtp_add_address(packet_info *pinfo, address *addr, int port, int other_port,
*/
if (! p_conv_data) {
/* Create conversation data */
p_conv_data = se_new(struct _rtp_conversation_info);
p_conv_data = wmem_new(wmem_file_scope(), struct _rtp_conversation_info);
p_conv_data->rtp_dyn_payload = NULL;
/* start this at 0x10000 so that we cope gracefully with the
* first few packets being out of order (hence 0,65535,1,2,...)
*/
p_conv_data->extended_seqno = 0x10000;
p_conv_data->rtp_conv_info = se_new(rtp_private_conv_info);
p_conv_data->rtp_conv_info->multisegment_pdus = se_tree_create(EMEM_TREE_TYPE_RED_BLACK,"rtp_ms_pdus");
p_conv_data->rtp_conv_info = wmem_new(wmem_file_scope(), rtp_private_conv_info);
p_conv_data->rtp_conv_info->multisegment_pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(p_conv, proto_rtp, p_conv_data);
}
@ -1103,7 +1103,7 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
#endif
/* look for a pdu which we might be extending */
msp = (rtp_multisegment_pdu *)se_tree_lookup32_le(finfo->multisegment_pdus,seqno-1);
msp = (rtp_multisegment_pdu *)wmem_tree_lookup32_le(finfo->multisegment_pdus,seqno-1);
if(msp && msp->startseq < seqno && msp->endseq >= seqno) {
guint32 fid = msp->startseq;
@ -1203,10 +1203,10 @@ dissect_rtp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
deseg_offset);
#endif
/* allocate a new msp for this pdu */
msp = se_new(rtp_multisegment_pdu);
msp = wmem_new(wmem_file_scope(), rtp_multisegment_pdu);
msp->startseq = seqno;
msp->endseq = seqno+1;
se_tree_insert32(finfo->multisegment_pdus,seqno,msp);
wmem_tree_insert32(finfo->multisegment_pdus,seqno,msp);
/*
* Add the fragment to the fragment table
@ -1291,7 +1291,7 @@ dissect_rtp_rfc2198(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
payload_type_str = NULL;
/* Allocate and fill in header */
hdr_new = ep_new(rfc2198_hdr);
hdr_new = wmem_new(wmem_packet_scope(), rfc2198_hdr);
hdr_new->next = NULL;
octet1 = tvb_get_guint8(tvb, offset);
hdr_new->pt = RTP_PAYLOAD_TYPE(octet1);
@ -2073,7 +2073,7 @@ get_conv_info(packet_info *pinfo, struct _rtp_info *rtp_info)
guint32 seqno;
/* Save this conversation info into packet info */
p_conv_packet_data = se_new(struct _rtp_conversation_info);
p_conv_packet_data = wmem_new(wmem_file_scope(), struct _rtp_conversation_info);
g_strlcpy(p_conv_packet_data->method, p_conv_data->method, MAX_RTP_SETUP_METHOD_SIZE+1);
p_conv_packet_data->frame_number = p_conv_data->frame_number;
p_conv_packet_data->is_video = p_conv_data->is_video;

View File

@ -31,7 +31,7 @@
#include <glib.h>
#include <epan/strutil.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/tap.h>
#include <epan/expert.h>
@ -184,14 +184,14 @@ static expert_field ei_osd2_query_values_equal= EI_INIT;
* there is an OSD session
*/
typedef struct _scsi_osd_conv_info_t {
emem_tree_t *luns;
wmem_tree_t *luns;
} scsi_osd_conv_info_t;
/* there will be one such structure created for each lun for each conversation
* that is handled by the OSD dissector
*/
struct _scsi_osd_lun_info_t {
emem_tree_t *partitions;
wmem_tree_t *partitions;
};
typedef void (*scsi_osd_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
@ -1295,22 +1295,22 @@ dissect_osd_partition_id(packet_info *pinfo, tvbuff_t *tvb, int offset,
proto_item_append_text(item, " (ROOT partition)");
} else {
partition_info_t *part_info;
emem_tree_key_t pikey[2];
wmem_tree_key_t pikey[2];
proto_tree *partition_tree=NULL;
pikey[0].length=2;
pikey[0].key=partition_id;
pikey[1].length=0;
part_info=(partition_info_t *)se_tree_lookup32_array(lun_info->partitions, &pikey[0]);
part_info=(partition_info_t *)wmem_tree_lookup32_array(lun_info->partitions, &pikey[0]);
if(!part_info){
part_info=se_new(partition_info_t);
part_info=wmem_new(wmem_file_scope(), partition_info_t);
part_info->created_in=0;
part_info->removed_in=0;
pikey[0].length=2;
pikey[0].key=partition_id;
pikey[1].length=0;
se_tree_insert32_array(lun_info->partitions, &pikey[0], part_info);
wmem_tree_insert32_array(lun_info->partitions, &pikey[0], part_info);
}
if(is_created){
part_info->created_in=pinfo->fd->num;
@ -3356,16 +3356,16 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* make sure we have a conversation info for this */
conv_info=(scsi_osd_conv_info_t *)conversation_get_proto_data(cdata->itl->conversation, proto_scsi_osd);
if(!conv_info){
conv_info=se_new(scsi_osd_conv_info_t);
conv_info->luns=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD luns tree");
conv_info=wmem_new(wmem_file_scope(), scsi_osd_conv_info_t);
conv_info->luns=wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(cdata->itl->conversation, proto_scsi_osd, conv_info);
}
/* make sure we have a lun_info structure for this */
lun_info=(scsi_osd_lun_info_t *)se_tree_lookup32(conv_info->luns, cdata->itlq->lun);
lun_info=(scsi_osd_lun_info_t *)wmem_tree_lookup32(conv_info->luns, cdata->itlq->lun);
if(!lun_info){
lun_info=se_new(scsi_osd_lun_info_t);
lun_info->partitions=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD partitions tree");
se_tree_insert32(conv_info->luns, cdata->itlq->lun, (void *)lun_info);
lun_info=wmem_new(wmem_file_scope(), scsi_osd_lun_info_t);
lun_info->partitions=wmem_tree_new(wmem_file_scope());
wmem_tree_insert32(conv_info->luns, cdata->itlq->lun, (void *)lun_info);
}
/* dissecting the CDB */
@ -3387,7 +3387,7 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if((!pinfo->fd->flags.visited) || (!cdata->itlq->extra_data)){
scsi_osd_extra_data_t *extra_data;
extra_data=se_new(scsi_osd_extra_data_t);
extra_data=wmem_new(wmem_file_scope(), scsi_osd_extra_data_t);
extra_data->svcaction=svcaction;
extra_data->gsatype=0;
extra_data->osd2=0;

View File

@ -40,7 +40,7 @@
#include <packet-tcp.h>
#include <epan/prefs.h>
#include <epan/conversation.h>
#include <epan/emem.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
static dissector_table_t media_type_dissector_table;
@ -60,7 +60,7 @@ typedef struct _xmcp_transaction_t {
} xmcp_transaction_t;
typedef struct _xmcp_conv_info_t {
emem_tree_t *transaction_pdus;
wmem_tree_t *transaction_pdus;
} xmcp_conv_info_t;
static int hf_xmcp_type = -1;
@ -839,7 +839,7 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* For request/response association */
guint32 transaction_id[3];
emem_tree_key_t transaction_id_key[2];
wmem_tree_key_t transaction_id_key[2];
conversation_t *conversation;
xmcp_conv_info_t *xmcp_conv_info;
xmcp_transaction_t *xmcp_trans;
@ -883,23 +883,21 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Do we already have XMCP state for this conversation? */
xmcp_conv_info = (xmcp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmcp);
if (!xmcp_conv_info) {
xmcp_conv_info = se_new(xmcp_conv_info_t);
xmcp_conv_info->transaction_pdus =
se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
"xmcp_pdus");
xmcp_conv_info = wmem_new(wmem_file_scope(), xmcp_conv_info_t);
xmcp_conv_info->transaction_pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conversation, proto_xmcp, xmcp_conv_info);
}
/* Find existing transaction entry or create a new one */
xmcp_trans = (xmcp_transaction_t *)se_tree_lookup32_array(xmcp_conv_info->transaction_pdus,
xmcp_trans = (xmcp_transaction_t *)wmem_tree_lookup32_array(xmcp_conv_info->transaction_pdus,
transaction_id_key);
if (!xmcp_trans) {
xmcp_trans = se_new(xmcp_transaction_t);
xmcp_trans = wmem_new(wmem_file_scope(), xmcp_transaction_t);
xmcp_trans->request_frame = 0;
xmcp_trans->response_frame = 0;
xmcp_trans->request_time = pinfo->fd->abs_ts;
xmcp_trans->request_is_keepalive = FALSE;
se_tree_insert32_array(xmcp_conv_info->transaction_pdus,
wmem_tree_insert32_array(xmcp_conv_info->transaction_pdus,
transaction_id_key, (void *)xmcp_trans);
}