diff options
-rw-r--r-- | epan/dissectors/packet-alcap.c | 64 | ||||
-rw-r--r-- | epan/dissectors/packet-classicstun.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-icmpv6.c | 49 | ||||
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 33 | ||||
-rw-r--r-- | epan/dissectors/packet-nfs.c | 54 | ||||
-rw-r--r-- | epan/dissectors/packet-rpc.c | 79 | ||||
-rw-r--r-- | epan/dissectors/packet-sua.c | 36 |
7 files changed, 166 insertions, 168 deletions
diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c index bf9baf1a27..88de2c833e 100644 --- a/epan/dissectors/packet-alcap.c +++ b/epan/dissectors/packet-alcap.c @@ -36,7 +36,7 @@ #include <wsutil/str_util.h> #include <epan/packet.h> -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #include <epan/prefs.h> #include "packet-alcap.h" #include "packet-mtp3.h" @@ -410,9 +410,9 @@ static expert_field ei_alcap_release_cause_not31 = EI_INIT; static gboolean keep_persistent_info = TRUE; -static emem_tree_t* legs_by_dsaid = NULL; -static emem_tree_t* legs_by_osaid = NULL; -static emem_tree_t* legs_by_bearer = NULL; +static wmem_tree_t* legs_by_dsaid = NULL; +static wmem_tree_t* legs_by_osaid = NULL; +static wmem_tree_t* legs_by_bearer = NULL; static const gchar* dissect_fields_unknown(packet_info* pinfo, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) { proto_item* pi = proto_tree_add_item(tree,hf_alcap_unknown,tvb,offset,len,ENC_NA); @@ -452,7 +452,7 @@ static const gchar* dissect_fields_cau(packet_info* pinfo, tvbuff_t *tvb, proto_ ret_str = val_to_str(msg_info->release_cause, cause_values_itu, "Unknown(%u)"); } else { proto_tree_add_item(tree, hf_alcap_cau_value_non_itu, tvb, offset+1 , 1, ENC_BIG_ENDIAN); - ret_str = ep_strdup_printf("%u", msg_info->release_cause); + ret_str = wmem_strdup_printf(wmem_packet_scope(), "%u", msg_info->release_cause); } if (!tree) return ret_str; @@ -518,9 +518,9 @@ static const gchar* dissect_fields_ceid(packet_info* pinfo _U_, tvbuff_t *tvb, p if (msg_info->cid == 0) { proto_item_append_text(pi," (All CIDs in the Path)"); - return ep_strdup_printf("Path: %u CID: 0 (Every CID)",msg_info->pathid); + return wmem_strdup_printf(wmem_packet_scope(), "Path: %u CID: 0 (Every CID)",msg_info->pathid); } else { - return ep_strdup_printf("Path: %u CID: %u",msg_info->pathid,msg_info->cid); + return wmem_strdup_printf(wmem_packet_scope(), "Path: %u CID: %u",msg_info->pathid,msg_info->cid); } } @@ -538,7 +538,7 @@ static const gchar* dissect_fields_desea(packet_info* pinfo _U_, tvbuff_t *tvb, return NULL; } - e164 = ep_new(e164_info_t); + e164 = wmem_new(wmem_packet_scope(), e164_info_t); e164->e164_number_type = CALLED_PARTY_NUMBER; e164->nature_of_address = tvb_get_guint8(tvb,offset) & 0x7f; @@ -564,7 +564,7 @@ static const gchar* dissect_fields_oesea(packet_info* pinfo _U_, tvbuff_t *tvb, return NULL; } - e164 = ep_new(e164_info_t); + e164 = wmem_new(wmem_packet_scope(), e164_info_t); e164->e164_number_type = CALLING_PARTY_NUMBER; e164->nature_of_address = tvb_get_guint8(tvb,offset) & 0x7f; @@ -1329,7 +1329,7 @@ static void alcap_leg_tree(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, extern void alcap_tree_from_bearer_key(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, const gchar* key) { - alcap_leg_info_t* leg = (alcap_leg_info_t*)se_tree_lookup_string(legs_by_bearer,key,0); + alcap_leg_info_t* leg = (alcap_leg_info_t*)wmem_tree_lookup_string(legs_by_bearer,key,0); if (leg) { alcap_leg_tree(tree,tvb,pinfo,leg); @@ -1340,7 +1340,7 @@ extern void alcap_tree_from_bearer_key(proto_tree* tree, tvbuff_t* tvb, packet_i static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *alcap_tree = NULL; - alcap_message_info_t* msg_info = ep_new0(alcap_message_info_t); + alcap_message_info_t* msg_info = wmem_new0(wmem_packet_scope(), alcap_message_info_t); int len = tvb_length(tvb); int offset; proto_item* pi; @@ -1408,8 +1408,8 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { alcap_leg_info_t* leg = NULL; switch (msg_info->msg_type) { case 5: /* ERQ */ - if( ! ( leg = (alcap_leg_info_t*)se_tree_lookup32(legs_by_osaid,msg_info->osaid) )) { - leg = se_new(alcap_leg_info_t); + if( ! ( leg = (alcap_leg_info_t*)wmem_tree_lookup32(legs_by_osaid,msg_info->osaid) )) { + leg = wmem_new(wmem_file_scope(), alcap_leg_info_t); leg->dsaid = 0; leg->osaid = msg_info->osaid; @@ -1420,45 +1420,45 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { leg->dest_nsap = NULL; if (msg_info->orig_nsap) { - gchar* key = se_strdup_printf("%s:%.8X",msg_info->orig_nsap,leg->sugr); + gchar* key = wmem_strdup_printf(wmem_file_scope(), "%s:%.8X",msg_info->orig_nsap,leg->sugr); ascii_strdown_inplace(key); - leg->orig_nsap = se_strdup(msg_info->orig_nsap); + leg->orig_nsap = wmem_strdup(wmem_file_scope(), msg_info->orig_nsap); - if (!se_tree_lookup_string(legs_by_bearer,key,0)) { - se_tree_insert_string(legs_by_bearer,key,leg,0); + if (!wmem_tree_lookup_string(legs_by_bearer,key,0)) { + wmem_tree_insert_string(legs_by_bearer,key,leg,0); } } if (msg_info->dest_nsap) { - gchar* key = se_strdup_printf("%s:%.8X",msg_info->dest_nsap,leg->sugr); + gchar* key = wmem_strdup_printf(wmem_file_scope(), "%s:%.8X",msg_info->dest_nsap,leg->sugr); ascii_strdown_inplace(key); - leg->dest_nsap = se_strdup(msg_info->dest_nsap); + leg->dest_nsap = wmem_strdup(wmem_file_scope(), msg_info->dest_nsap); - if (!se_tree_lookup_string(legs_by_bearer,key,0)) { - se_tree_insert_string(legs_by_bearer,key,leg,0); + if (!wmem_tree_lookup_string(legs_by_bearer,key,0)) { + wmem_tree_insert_string(legs_by_bearer,key,leg,0); } } leg->msgs = NULL; leg->release_cause = 0; - se_tree_insert32(legs_by_osaid,leg->osaid,leg); + wmem_tree_insert32(legs_by_osaid,leg->osaid,leg); } break; case 4: /* ECF */ - if(( leg = (alcap_leg_info_t *)se_tree_lookup32(legs_by_osaid,msg_info->dsaid) )) { + if(( leg = (alcap_leg_info_t *)wmem_tree_lookup32(legs_by_osaid,msg_info->dsaid) )) { leg->dsaid = msg_info->osaid; - se_tree_insert32(legs_by_dsaid,leg->dsaid,leg); + wmem_tree_insert32(legs_by_dsaid,leg->dsaid,leg); } break; case 6: /* RLC */ case 12: /* MOA */ case 13: /* MOR */ case 14: /* MOD */ - if( ( leg = (alcap_leg_info_t *)se_tree_lookup32(legs_by_osaid,msg_info->dsaid) ) - || ( leg = (alcap_leg_info_t *)se_tree_lookup32(legs_by_dsaid,msg_info->dsaid) ) ) { + if( ( leg = (alcap_leg_info_t *)wmem_tree_lookup32(legs_by_osaid,msg_info->dsaid) ) + || ( leg = (alcap_leg_info_t *)wmem_tree_lookup32(legs_by_dsaid,msg_info->dsaid) ) ) { if(msg_info->release_cause) leg->release_cause = msg_info->release_cause; @@ -1466,11 +1466,11 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { } break; case 7: /* REL */ - leg = (alcap_leg_info_t *)se_tree_lookup32(legs_by_osaid,msg_info->dsaid); + leg = (alcap_leg_info_t *)wmem_tree_lookup32(legs_by_osaid,msg_info->dsaid); if(leg) { leg->release_cause = msg_info->release_cause; - } else if (( leg = (alcap_leg_info_t *)se_tree_lookup32(legs_by_dsaid,msg_info->dsaid) )) { + } else if (( leg = (alcap_leg_info_t *)wmem_tree_lookup32(legs_by_dsaid,msg_info->dsaid) )) { leg->release_cause = msg_info->release_cause; } break; @@ -1479,7 +1479,7 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { } if (leg != NULL && ( (! leg->msgs) || leg->msgs->last->framenum < pinfo->fd->num ) ) { - alcap_msg_data_t* msg = se_new(alcap_msg_data_t); + alcap_msg_data_t* msg = wmem_new(wmem_file_scope(), alcap_msg_data_t); msg->msg_type = msg_info->msg_type; msg->framenum = pinfo->fd->num; msg->next = NULL; @@ -2425,9 +2425,9 @@ proto_register_alcap(void) "Whether persistent call leg information is to be kept", &keep_persistent_info); - legs_by_dsaid = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "legs_by_dsaid"); - legs_by_osaid = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "legs_by_osaid"); - legs_by_bearer = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "legs_by_bearer"); + legs_by_dsaid = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + legs_by_osaid = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + legs_by_bearer = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } diff --git a/epan/dissectors/packet-classicstun.c b/epan/dissectors/packet-classicstun.c index 2a1624424c..4d39af5d0f 100644 --- a/epan/dissectors/packet-classicstun.c +++ b/epan/dissectors/packet-classicstun.c @@ -32,6 +32,7 @@ #include <epan/packet.h> #include <epan/conversation.h> +#include <epan/wmem/wmem.h> void proto_register_classicstun(void); void proto_reg_handoff_classicstun(void); @@ -80,7 +81,7 @@ typedef struct _classicstun_transaction_t { /* Structure containing conversation specific information */ typedef struct _classicstun_conv_info_t { - emem_tree_t *pdus; + wmem_tree_t *pdus; } classicstun_conv_info_t; @@ -229,7 +230,7 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d conversation_t *conversation; classicstun_conv_info_t *classicstun_info; classicstun_transaction_t *classicstun_trans; - emem_tree_key_t transaction_id_key[2]; + wmem_tree_key_t transaction_id_key[2]; guint32 transaction_id[4]; @@ -285,33 +286,33 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - classicstun_info = se_new(classicstun_conv_info_t); - classicstun_info->pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "classicstun_pdus"); + classicstun_info = wmem_new(wmem_file_scope(), classicstun_conv_info_t); + classicstun_info->pdus=wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_classicstun, classicstun_info); } if(!pinfo->fd->flags.visited){ if (((msg_type & CLASS_MASK) >> 4) == REQUEST) { /* This is a request */ - classicstun_trans=se_new(classicstun_transaction_t); + classicstun_trans=wmem_new(wmem_file_scope(), classicstun_transaction_t); classicstun_trans->req_frame=pinfo->fd->num; classicstun_trans->rep_frame=0; classicstun_trans->req_time=pinfo->fd->abs_ts; - se_tree_insert32_array(classicstun_info->pdus, transaction_id_key, + wmem_tree_insert32_array(classicstun_info->pdus, transaction_id_key, (void *)classicstun_trans); } else { - classicstun_trans=(classicstun_transaction_t *)se_tree_lookup32_array(classicstun_info->pdus, + classicstun_trans=(classicstun_transaction_t *)wmem_tree_lookup32_array(classicstun_info->pdus, transaction_id_key); if(classicstun_trans){ classicstun_trans->rep_frame=pinfo->fd->num; } } } else { - classicstun_trans=(classicstun_transaction_t *)se_tree_lookup32_array(classicstun_info->pdus, transaction_id_key); + classicstun_trans=(classicstun_transaction_t *)wmem_tree_lookup32_array(classicstun_info->pdus, transaction_id_key); } if(!classicstun_trans){ /* create a "fake" pana_trans structure */ - classicstun_trans=ep_new(classicstun_transaction_t); + classicstun_trans=wmem_new(wmem_packet_scope(), classicstun_transaction_t); classicstun_trans->req_frame=0; classicstun_trans->rep_frame=0; classicstun_trans->req_time=pinfo->fd->abs_ts; diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 6f67460a7f..08361d1c41 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -47,7 +47,7 @@ #include <epan/strutil.h> #include <epan/expert.h> #include <epan/conversation.h> -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #include <epan/tap.h> #include "packet-ber.h" @@ -463,8 +463,8 @@ static int hf_icmpv6_resp_to = -1; static int hf_icmpv6_resptime = -1; typedef struct _icmpv6_conv_info_t { - emem_tree_t *unmatched_pdus; - emem_tree_t *matched_pdus; + wmem_tree_t *unmatched_pdus; + wmem_tree_t *matched_pdus; } icmpv6_conv_info_t; static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tree, guint32 *key); @@ -1139,18 +1139,16 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre conversation_t *conversation; icmpv6_conv_info_t *icmpv6_info; icmp_transaction_t *icmpv6_trans; - emem_tree_key_t icmpv6_key[3]; + wmem_tree_key_t icmpv6_key[3]; proto_item *it; /* Handle the conversation tracking */ conversation = _find_or_create_conversation(pinfo); icmpv6_info = (icmpv6_conv_info_t *)conversation_get_proto_data(conversation, proto_icmpv6); if (icmpv6_info == NULL) { - icmpv6_info = se_new(icmpv6_conv_info_t); - icmpv6_info->unmatched_pdus = se_tree_create_non_persistent( - EMEM_TREE_TYPE_RED_BLACK, "icmpv6_unmatched_pdus"); - icmpv6_info->matched_pdus = se_tree_create_non_persistent( - EMEM_TREE_TYPE_RED_BLACK, "icmpv6_matched_pdus"); + icmpv6_info = wmem_new(wmem_file_scope(), icmpv6_conv_info_t); + icmpv6_info->unmatched_pdus = wmem_tree_new(wmem_file_scope()); + icmpv6_info->matched_pdus = wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_icmpv6, icmpv6_info); } @@ -1164,12 +1162,12 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre icmpv6_key[1].length = 0; icmpv6_key[1].key = NULL; - icmpv6_trans = se_new(icmp_transaction_t); + icmpv6_trans = wmem_new(wmem_file_scope(), icmp_transaction_t); icmpv6_trans->rqst_frame = PINFO_FD_NUM(pinfo); icmpv6_trans->resp_frame = 0; icmpv6_trans->rqst_time = pinfo->fd->abs_ts; nstime_set_zero(&icmpv6_trans->resp_time); - se_tree_insert32_array(icmpv6_info->unmatched_pdus, icmpv6_key, (void *)icmpv6_trans); + wmem_tree_insert32_array(icmpv6_info->unmatched_pdus, icmpv6_key, (void *)icmpv6_trans); } else { /* Already visited this frame */ guint32 frame_num = pinfo->fd->num; @@ -1181,7 +1179,7 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre icmpv6_key[2].length = 0; icmpv6_key[2].key = NULL; - icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)wmem_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); } if (icmpv6_trans == NULL) @@ -1207,7 +1205,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, conversation_t *conversation; icmpv6_conv_info_t *icmpv6_info; icmp_transaction_t *icmpv6_trans; - emem_tree_key_t icmpv6_key[3]; + wmem_tree_key_t icmpv6_key[3]; proto_item *it; nstime_t ns; double resp_time; @@ -1229,7 +1227,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, icmpv6_key[1].length = 0; icmpv6_key[1].key = NULL; - icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->unmatched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)wmem_tree_lookup32_array(icmpv6_info->unmatched_pdus, icmpv6_key); if (icmpv6_trans == NULL) return NULL; @@ -1251,10 +1249,10 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, icmpv6_key[2].key = NULL; frame_num = icmpv6_trans->rqst_frame; - se_tree_insert32_array(icmpv6_info->matched_pdus, icmpv6_key, (void *)icmpv6_trans); + wmem_tree_insert32_array(icmpv6_info->matched_pdus, icmpv6_key, (void *)icmpv6_trans); frame_num = icmpv6_trans->resp_frame; - se_tree_insert32_array(icmpv6_info->matched_pdus, icmpv6_key, (void *)icmpv6_trans); + wmem_tree_insert32_array(icmpv6_info->matched_pdus, icmpv6_key, (void *)icmpv6_trans); } else { /* Already visited this frame */ guint32 frame_num = pinfo->fd->num; @@ -1266,7 +1264,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, icmpv6_key[2].length = 0; icmpv6_key[2].key = NULL; - icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)wmem_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); if (icmpv6_trans == NULL) return NULL; } @@ -3520,7 +3518,7 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ case ICMP6_ND_NEIGHBOR_ADVERT: /* Neighbor Advertisement (136) */ { guint32 na_flags; - emem_strbuf_t *flags_strbuf = ep_strbuf_new_label(""); + wmem_strbuf_t *flags_strbuf = wmem_strbuf_new_label(wmem_packet_scope()); /* Flags */ ti_flag = proto_tree_add_item(icmp6_tree, hf_icmpv6_nd_na_flag, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -3537,21 +3535,22 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ if (na_flags & ND_NA_FLAG_R) { - ep_strbuf_append(flags_strbuf, "rtr, "); + wmem_strbuf_append(flags_strbuf, "rtr, "); } if (na_flags & ND_NA_FLAG_S) { - ep_strbuf_append(flags_strbuf, "sol, "); + wmem_strbuf_append(flags_strbuf, "sol, "); } if (na_flags & ND_NA_FLAG_O) { - ep_strbuf_append(flags_strbuf, "ovr, "); + wmem_strbuf_append(flags_strbuf, "ovr, "); } - if (flags_strbuf->len > 2) { - ep_strbuf_truncate(flags_strbuf, flags_strbuf->len - 2); + if (wmem_strbuf_get_len(flags_strbuf) > 2) { + wmem_strbuf_truncate(flags_strbuf, wmem_strbuf_get_len(flags_strbuf) - 2); } else { - ep_strbuf_printf(flags_strbuf, "none"); + wmem_strbuf_truncate(flags_strbuf, 0); + wmem_strbuf_append(flags_strbuf, "none"); } - col_append_fstr(pinfo->cinfo, COL_INFO, " %s (%s)", tvb_ip6_to_str(tvb, offset), flags_strbuf->str); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s (%s)", tvb_ip6_to_str(tvb, offset), wmem_strbuf_get_str(flags_strbuf)); offset += 16; /* Show options */ diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 96cc949715..906f7516e5 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -44,7 +44,6 @@ #include <epan/prefs.h> #include <epan/conversation.h> #include "packet-scsi.h" -#include <epan/emem.h> #include <epan/wmem/wmem.h> #include <epan/range.h> #include <wsutil/crc32.h> @@ -219,8 +218,8 @@ static gint ett_iscsi_ISID = -1; /* this structure contains session wide state for a specific tcp conversation */ typedef struct _iscsi_session_t { guint32 header_digest; - emem_tree_t *itlq; /* indexed by ITT */ - emem_tree_t *itl; /* indexed by LUN */ + wmem_tree_t *itlq; /* indexed by ITT */ + wmem_tree_t *itl; /* indexed by LUN */ } iscsi_session_t; @@ -533,7 +532,7 @@ iscsi_dissect_TargetAddress(packet_info *pinfo, proto_tree *tree _U_,char *val) { address *addr = NULL; int port; - char *value = ep_strdup(val); + char *value = wmem_strdup(wmem_packet_scope(), val); char *p = NULL, *pgt = NULL; if (value[0] == '[') { @@ -564,10 +563,10 @@ iscsi_dissect_TargetAddress(packet_info *pinfo, proto_tree *tree _U_,char *val) *pgt++ = 0; } - addr = ep_new(address); + addr = wmem_new(wmem_packet_scope(), address); addr->type = AT_IPv4; addr->len = 4; - addr->data = ep_alloc(4); + addr->data = wmem_alloc(wmem_packet_scope(), 4); ((char *)addr->data)[0] = i0; ((char *)addr->data)[1] = i1; ((char *)addr->data)[2] = i2; @@ -742,9 +741,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSCSI"); /* XXX we need a way to handle replayed iscsi itt here */ - cdata=(iscsi_conv_data_t *)se_tree_lookup32(iscsi_session->itlq, tvb_get_ntohl(tvb, offset+16)); + cdata=(iscsi_conv_data_t *)wmem_tree_lookup32(iscsi_session->itlq, tvb_get_ntohl(tvb, offset+16)); if(!cdata){ - cdata = se_new(iscsi_conv_data_t); + cdata = wmem_new(wmem_file_scope(), iscsi_conv_data_t); cdata->itlq.lun=0xffff; cdata->itlq.scsi_opcode=0xffff; cdata->itlq.task_flags=0; @@ -759,7 +758,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off cdata->data_in_frame=0; cdata->data_out_frame=0; - se_tree_insert32(iscsi_session->itlq, tvb_get_ntohl(tvb, offset+16), cdata); + wmem_tree_insert32(iscsi_session->itlq, tvb_get_ntohl(tvb, offset+16), cdata); } if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || @@ -812,18 +811,18 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off cdata->itlq.lun=lun; cdata->itlq.first_exchange_frame=pinfo->fd->num; - itl=(itl_nexus_t *)se_tree_lookup32(iscsi_session->itl, lun); + itl=(itl_nexus_t *)wmem_tree_lookup32(iscsi_session->itl, lun); if(!itl){ - itl=se_new(itl_nexus_t); + itl=wmem_new(wmem_file_scope(), itl_nexus_t); itl->cmdset=0xff; itl->conversation=conversation; - se_tree_insert32(iscsi_session->itl, lun, itl); + wmem_tree_insert32(iscsi_session->itl, lun, itl); } } if(!itl){ - itl=(itl_nexus_t *)se_tree_lookup32(iscsi_session->itl, cdata->itlq.lun); + itl=(itl_nexus_t *)wmem_tree_lookup32(iscsi_session->itl, cdata->itlq.lun); } @@ -2342,10 +2341,10 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec iscsi_session=(iscsi_session_t *)conversation_get_proto_data(conversation, proto_iscsi); if(!iscsi_session){ - iscsi_session=se_new(iscsi_session_t); - iscsi_session->header_digest=ISCSI_HEADER_DIGEST_AUTO; - iscsi_session->itlq=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "iSCSI ITLQ"); - iscsi_session->itl=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "iSCSI ITL"); + iscsi_session = wmem_new(wmem_file_scope(), iscsi_session_t); + iscsi_session->header_digest = ISCSI_HEADER_DIGEST_AUTO; + iscsi_session->itlq = wmem_tree_new(wmem_file_scope()); + iscsi_session->itl = wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_iscsi, iscsi_session); /* DataOut PDUs are often mistaken by DCERPC heuristics to be diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 635490f64c..d1ff44dcec 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -34,7 +34,7 @@ #include "packet-nfs.h" #include <epan/prefs.h> #include <epan/packet.h> -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #include <epan/strutil.h> #include <wsutil/crc16.h> #include <wsutil/crc32.h> @@ -762,7 +762,7 @@ typedef struct nfs_fhandle_data { /* fhandle displayfilters to match also corresponding request/response packet in addition to the one containing the actual filehandle */ gboolean nfs_fhandle_reqrep_matching = FALSE; -static emem_tree_t *nfs_fhandle_frame_table = NULL; +static wmem_tree_t *nfs_fhandle_frame_table = NULL; /* file name snooping */ @@ -789,8 +789,8 @@ static GHashTable *nfs_name_snoop_unmatched = NULL; static GHashTable *nfs_name_snoop_matched = NULL; -static emem_tree_t *nfs_name_snoop_known = NULL; -static emem_tree_t *nfs_file_handles = NULL; +static wmem_tree_t *nfs_name_snoop_known = NULL; +static wmem_tree_t *nfs_file_handles = NULL; static gboolean nfs_display_v4_tag = TRUE; static gboolean display_major_nfs4_ops = TRUE; @@ -817,7 +817,7 @@ store_nfs_file_handle(nfs_fhandle_data_t *nfs_fh) { guint32 fhlen; guint32 *fhdata; - emem_tree_key_t fhkey[3]; + wmem_tree_key_t fhkey[3]; nfs_fhandle_data_t *new_nfs_fh; fhlen=nfs_fh->len/4; @@ -829,15 +829,15 @@ store_nfs_file_handle(nfs_fhandle_data_t *nfs_fh) fhkey[1].key=fhdata; fhkey[2].length=0; - new_nfs_fh=(nfs_fhandle_data_t *)se_tree_lookup32_array(nfs_file_handles, &fhkey[0]); + new_nfs_fh=(nfs_fhandle_data_t *)wmem_tree_lookup32_array(nfs_file_handles, &fhkey[0]); if(new_nfs_fh){ g_free(fhdata); return new_nfs_fh; } - new_nfs_fh=(nfs_fhandle_data_t *)se_alloc(sizeof(nfs_fhandle_data_t)); + new_nfs_fh=wmem_new(wmem_file_scope(), nfs_fhandle_data_t); new_nfs_fh->len=nfs_fh->len; - new_nfs_fh->fh=(const unsigned char *)se_alloc(sizeof(guint32)*(nfs_fh->len/4)); + new_nfs_fh->fh=(const unsigned char *)wmem_alloc(wmem_file_scope(), sizeof(guint32)*(nfs_fh->len/4)); memcpy((void *)new_nfs_fh->fh, nfs_fh->fh, nfs_fh->len); fhlen=nfs_fh->len/4; fhkey[0].length=1; @@ -845,7 +845,7 @@ store_nfs_file_handle(nfs_fhandle_data_t *nfs_fh) fhkey[1].length=fhlen; fhkey[1].key=fhdata; fhkey[2].length=0; - se_tree_insert32_array(nfs_file_handles, &fhkey[0], new_nfs_fh); + wmem_tree_insert32_array(nfs_file_handles, &fhkey[0], new_nfs_fh); g_free(fhdata); return new_nfs_fh; @@ -1046,7 +1046,7 @@ nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length) nns->fh=fh; nns->fh_length=fh_length; - key=(nfs_name_snoop_key_t *)se_alloc(sizeof(nfs_name_snoop_key_t)); + key=wmem_new(wmem_file_scope(), nfs_name_snoop_key_t); key->key=0; key->fh_length=nns->fh_length; key->fh=nns->fh; @@ -1124,7 +1124,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of if(nns){ guint32 fhlen; guint32 *fhdata; - emem_tree_key_t fhkey[3]; + wmem_tree_key_t fhkey[3]; fhlen=nns->fh_length; /* align it */ @@ -1134,7 +1134,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of fhkey[1].length=fhlen/4; fhkey[1].key=fhdata; fhkey[2].length=0; - se_tree_insert32_array(nfs_name_snoop_known, &fhkey[0], nns); + wmem_tree_insert32_array(nfs_name_snoop_known, &fhkey[0], nns); g_free(fhdata); if(nfs_file_name_full_snooping){ @@ -1154,7 +1154,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of if(!nns){ guint32 fhlen; guint32 *fhdata; - emem_tree_key_t fhkey[3]; + wmem_tree_key_t fhkey[3]; fhlen=fh_length; /* align it */ @@ -1165,7 +1165,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of fhkey[1].key=fhdata; fhkey[2].length=0; - nns=(nfs_name_snoop_t *)se_tree_lookup32_array(nfs_name_snoop_known, &fhkey[0]); + nns=(nfs_name_snoop_t *)wmem_tree_lookup32_array(nfs_name_snoop_known, &fhkey[0]); g_free(fhdata); } @@ -1621,7 +1621,7 @@ dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *t " METADATA" }; guint16 bit = sizeof(strings) / sizeof(strings[0]); - flag_string=(char *)ep_alloc(512); + flag_string=(char *)wmem_alloc(wmem_packet_scope(), 512); flag_string[0]=0; while (bit--) { if (flags & (1<<bit)) { @@ -1715,7 +1715,7 @@ dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree guint16 bit = sizeof(strings) / sizeof(strings[0]); proto_tree *flag_tree = NULL; - flag_string=(char *)ep_alloc(512); + flag_string=(char *)wmem_alloc(wmem_packet_scope(), 512); flag_string[0]=0; if(tree){ @@ -2344,7 +2344,7 @@ dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * nfs calls. For now, we don't handle this and those calls will not work properly with this feature */ - se_tree_insert32(nfs_fhandle_frame_table, pinfo->fd->num, old_fhd); + wmem_tree_insert32(nfs_fhandle_frame_table, pinfo->fd->num, old_fhd); } } @@ -2398,7 +2398,7 @@ dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, int frame) { nfs_fhandle_data_t *nfd; - nfd=(nfs_fhandle_data_t *)se_tree_lookup32(nfs_fhandle_frame_table, frame); + nfd=(nfs_fhandle_data_t *)wmem_tree_lookup32(nfs_fhandle_frame_table, frame); if(nfd && nfd->len){ tvbuff_t *tvb; tvb = tvb_new_real_data(nfd->fh, nfd->len, nfd->len); @@ -5016,7 +5016,7 @@ dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr /* Get access mask to check and save it for comparison to the access reply. */ amask = tvb_get_ntohl(tvb, offset); - acc_request = (guint32 *)se_memdup( &amask, sizeof(guint32)); + acc_request = (guint32 *)wmem_memdup(wmem_file_scope(), &amask, sizeof(guint32)); civ = (rpc_call_info_value *)pinfo->private_data; civ->private_data = acc_request; @@ -6774,7 +6774,7 @@ dissect_nfs4_fattr_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree) /* TODO: this should be replaced with a named field and * proto_tree_add_item */ - buf = (char *)ep_alloc(1025); + buf = (char *)wmem_alloc(wmem_packet_scope(), 1025); p = decode_bitfield_value(buf, expire_type, 0xFFFFFFFF, 32); g_snprintf(p, (gulong) (1024-(p-buf)), "%s", val_to_str_const(expire_type, @@ -7034,7 +7034,7 @@ dissect_nfs4_fattrs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t tvb_ensure_bytes_exist(tvb, offset, num_bitmaps * 4); if(num_bitmaps) { - bitmaps = (guint32 *)ep_alloc(num_bitmaps * sizeof(guint32)); + bitmaps = (guint32 *)wmem_alloc(wmem_packet_scope(), num_bitmaps * sizeof(guint32)); attr_mask_offset = offset; /* Load the array with the bitmap(s) */ @@ -7864,7 +7864,7 @@ dissect_nfs4_dirlist(tvbuff_t *tvb, int offset, packet_info *pinfo, /* * Get the entry name and create subtree of field nfs.name */ - name = (char *)tvb_memcpy(tvb, ep_alloc(name_len+1), offset + 16, name_len); + name = (char *)tvb_memcpy(tvb, wmem_alloc(wmem_packet_scope(), name_len+1), offset + 16, name_len); name[name_len] = '\0'; eitem = proto_tree_add_string_format( @@ -8060,7 +8060,7 @@ dissect_nfs4_state_protect_bitmap(tvbuff_t *tvb, int offset, newftree = proto_item_add_subtree(fitem, ett_nfs4_bitmap); if(num_bitmaps) - bitmap = (guint32 *)ep_alloc(num_bitmaps * sizeof(guint32)); + bitmap = (guint32 *)wmem_alloc(wmem_packet_scope(), num_bitmaps * sizeof(guint32)); for (i = 0; i < num_bitmaps; i++) { bitmap[i] = tvb_get_ntohl(tvb, offset); @@ -8929,7 +8929,7 @@ dissect_nfs4_request_op(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre /* Get access mask to check and save it for comparison in the reply. */ amask = tvb_get_ntohl(tvb, offset); - acc_request = (guint32 *)se_memdup( &amask, sizeof(guint32)); + acc_request = (guint32 *)wmem_memdup(wmem_file_scope(), &amask, sizeof(guint32)); civ = (rpc_call_info_value *)pinfo->private_data; civ->private_data = acc_request; @@ -12644,9 +12644,9 @@ proto_register_nfs(void) nfs_fhandle_types, FALSE); - nfs_name_snoop_known=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nfs_name_snoop_known"); - nfs_file_handles=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nfs_file_handles"); - nfs_fhandle_frame_table=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "nfs_fhandle_frame_table"); + nfs_name_snoop_known = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + nfs_file_handles = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + nfs_fhandle_frame_table = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); register_init_routine(nfs_name_snoop_init); } diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 58c778c59d..f2d1080c69 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -33,13 +33,12 @@ #include <epan/packet.h> #include <epan/conversation.h> -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #include <epan/prefs.h> #include <epan/reassemble.h> #include <epan/tap.h> #include <epan/strutil.h> #include <epan/garrayfix.h> -#include <epan/emem.h> #include <epan/show_exception.h> #include "packet-rpc.h" @@ -385,7 +384,7 @@ rpc_proc_name(guint32 prog, guint32 vers, guint32 proc) else { /* happens only with strange program versions or non-existing dissectors */ - procname = ep_strdup_printf("proc-%u", key.proc); + procname = wmem_strdup_printf(wmem_packet_scope(), "proc-%u", key.proc); } return procname; } @@ -486,7 +485,7 @@ rpc_prog_name(guint32 prog) * RPC and contains the state we need to maintain for the conversation. */ typedef struct _rpc_conv_info_t { - emem_tree_t *xids; + wmem_tree_t *xids; } rpc_conv_info_t; @@ -495,7 +494,7 @@ typedef struct _rpc_conv_info_t { a global tree for all contexts should still be unlikely to have collissions here. */ -emem_tree_t *authgss_contexts = NULL; +wmem_tree_t *authgss_contexts = NULL; unsigned int rpc_roundup(unsigned int a) @@ -640,7 +639,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, if (string_data) { string_buffer = tvb_get_ephemeral_string(tvb, data_offset, string_length_copy); } else { - string_buffer = (char *)tvb_memcpy(tvb, ep_alloc(string_length_copy+1), data_offset, string_length_copy); + string_buffer = (char *)tvb_memcpy(tvb, wmem_alloc(wmem_packet_scope(), string_length_copy+1), data_offset, string_length_copy); } string_buffer[string_length_copy] = '\0'; /* calculate a nice printable string */ @@ -651,14 +650,14 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, formatted = format_text(string_buffer, strlen(string_buffer)); /* copy over the data and append <TRUNCATED> */ - string_buffer_print=ep_strdup_printf("%s%s", formatted, RPC_STRING_TRUNCATED); + string_buffer_print=wmem_strdup_printf(wmem_packet_scope(), "%s%s", formatted, RPC_STRING_TRUNCATED); } else { string_buffer_print=RPC_STRING_DATA RPC_STRING_TRUNCATED; } } else { if (string_data) { string_buffer_print = - ep_strdup(format_text(string_buffer, strlen(string_buffer))); + wmem_strdup(wmem_packet_scope(), format_text(string_buffer, strlen(string_buffer))); } else { string_buffer_print=RPC_STRING_DATA; } @@ -912,7 +911,7 @@ dissect_rpc_authgss_context(proto_tree *tree, tvbuff_t *tvb, int offset, int context_offset; guint32 context_length; gssauth_context_info_t *context_info; - emem_tree_key_t tkey[2]; + wmem_tree_key_t tkey[2]; guint32 key[4] = {0,0,0,0}; context_item = proto_tree_add_text(tree, tvb, offset, -1, @@ -942,7 +941,7 @@ dissect_rpc_authgss_context(proto_tree *tree, tvbuff_t *tvb, int offset, tkey[1].length = 0; tkey[1].key = NULL; - context_info = (gssauth_context_info_t *)se_tree_lookup32_array(authgss_contexts, &tkey[0]); + context_info = (gssauth_context_info_t *)wmem_tree_lookup32_array(authgss_contexts, &tkey[0]); if(context_info == NULL) { tvb_memcpy(tvb, key, context_offset, context_length); tkey[0].length = 4; @@ -950,10 +949,10 @@ dissect_rpc_authgss_context(proto_tree *tree, tvbuff_t *tvb, int offset, tkey[1].length = 0; tkey[1].key = NULL; - context_info = se_new(gssauth_context_info_t); + context_info = wmem_new(wmem_file_scope(), gssauth_context_info_t); context_info->create_frame = 0; context_info->destroy_frame = 0; - se_tree_insert32_array(authgss_contexts, &tkey[0], context_info); + wmem_tree_insert32_array(authgss_contexts, &tkey[0], context_info); } if (is_create) { context_info->create_frame = pinfo->fd->num; @@ -1603,8 +1602,8 @@ dissect_rpc_indir_call(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. */ - rpc_conv_info = se_new(rpc_conv_info_t); - rpc_conv_info->xids=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rpc_xids"); + rpc_conv_info = wmem_new(wmem_file_scope(), rpc_conv_info_t); + rpc_conv_info->xids=wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_rpc, rpc_conv_info); } @@ -1620,13 +1619,13 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, as such, the XID is at offset 0 in this tvbuff. */ /* look up the request */ xid = tvb_get_ntohl(tvb, offset); - rpc_call = (rpc_call_info_value *)se_tree_lookup32(rpc_conv_info->xids, xid); + rpc_call = (rpc_call_info_value *)wmem_tree_lookup32(rpc_conv_info->xids, xid); if (rpc_call == NULL) { /* We didn't find it; create a new entry. Prepare the value data. Not all of it is needed for handling indirect calls, so we set a bunch of items to 0. */ - rpc_call = se_new(rpc_call_info_value); + rpc_call = wmem_new(wmem_file_scope(), rpc_call_info_value); rpc_call->req_num = 0; rpc_call->rep_num = 0; rpc_call->prog = prog; @@ -1643,7 +1642,7 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rpc_call->gss_svc = 0; rpc_call->proc_info = value; /* store it */ - se_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); + wmem_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); } } else { @@ -1735,14 +1734,14 @@ dissect_rpc_indir_reply(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. */ - rpc_conv_info = se_new(rpc_conv_info_t); - rpc_conv_info->xids=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rpc_xids"); + rpc_conv_info = wmem_new(wmem_file_scope(), rpc_conv_info_t); + rpc_conv_info->xids=wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_rpc, rpc_conv_info); } /* The XIDs of the call and reply must match. */ xid = tvb_get_ntohl(tvb, 0); - rpc_call = (rpc_call_info_value *)se_tree_lookup32(rpc_conv_info->xids, xid); + rpc_call = (rpc_call_info_value *)wmem_tree_lookup32(rpc_conv_info->xids, xid); if (rpc_call == NULL) { /* The XID doesn't match a call from that conversation, so it's probably not an RPC reply. @@ -1758,14 +1757,14 @@ dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, procname = (char *)rpc_call->proc_info->name; } else { - procname=ep_strdup_printf("proc-%u", rpc_call->proc); + procname=wmem_strdup_printf(wmem_packet_scope(), "proc-%u", rpc_call->proc); } } else { #if 0 dissect_function = NULL; #endif - procname=ep_strdup_printf("proc-%u", rpc_call->proc); + procname=wmem_strdup_printf(wmem_packet_scope(), "proc-%u", rpc_call->proc); } if ( tree ) @@ -2037,15 +2036,15 @@ dissect_rpc_message(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. */ - rpc_conv_info = se_new(rpc_conv_info_t); - rpc_conv_info->xids=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rpc_xids"); + rpc_conv_info = wmem_new(wmem_file_scope(), rpc_conv_info_t); + rpc_conv_info->xids=wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_rpc, rpc_conv_info); } /* The XIDs of the call and reply must match. */ xid = tvb_get_ntohl(tvb, offset); - rpc_call = (rpc_call_info_value *)se_tree_lookup32(rpc_conv_info->xids, xid); + rpc_call = (rpc_call_info_value *)wmem_tree_lookup32(rpc_conv_info->xids, xid); if (rpc_call == NULL) { /* The XID doesn't match a call from that conversation, so it's probably not an RPC reply. */ @@ -2057,7 +2056,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* in parse-partials, so define a dummy conversation for this reply */ - rpc_call = se_new(rpc_call_info_value); + rpc_call = wmem_new(wmem_file_scope(), rpc_call_info_value); rpc_call->req_num = 0; rpc_call->rep_num = pinfo->fd->num; rpc_call->prog = 0; @@ -2072,7 +2071,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rpc_call->req_time = pinfo->fd->abs_ts; /* store it */ - se_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); + wmem_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); /* and fake up a matching program */ rpc_prog_key.prog = rpc_call->prog; @@ -2184,7 +2183,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #if 0 dissect_function = NULL; #endif - procname=ep_strdup_printf("proc-%u", proc); + procname=wmem_strdup_printf(wmem_packet_scope(), "proc-%u", proc); } /* Check for RPCSEC_GSS and AUTH_GSSAPI */ @@ -2315,8 +2314,8 @@ dissect_rpc_message(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. */ - rpc_conv_info = se_new(rpc_conv_info_t); - rpc_conv_info->xids=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rpc_xids"); + rpc_conv_info = wmem_new(wmem_file_scope(), rpc_conv_info_t); + rpc_conv_info->xids=wmem_tree_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_rpc, rpc_conv_info); } @@ -2327,7 +2326,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, (pinfo->ptype == PT_TCP) ? rpc_tcp_handle : rpc_handle); /* look up the request */ - rpc_call = (rpc_call_info_value *)se_tree_lookup32(rpc_conv_info->xids, xid); + rpc_call = (rpc_call_info_value *)wmem_tree_lookup32(rpc_conv_info->xids, xid); if (rpc_call) { /* We've seen a request with this XID, with the same source and destination, before - but was it @@ -2352,7 +2351,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, frame numbers are 1-origin, so we use 0 to mean "we don't yet know in which frame the reply for this call appears". */ - rpc_call = se_new(rpc_call_info_value); + rpc_call = wmem_new(wmem_file_scope(), rpc_call_info_value); rpc_call->req_num = pinfo->fd->num; rpc_call->rep_num = 0; rpc_call->prog = prog; @@ -2367,7 +2366,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rpc_call->req_time = pinfo->fd->abs_ts; /* store it */ - se_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); + wmem_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call); } if(rpc_call->rep_num){ @@ -2414,14 +2413,14 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, procname = (char *)rpc_call->proc_info->name; } else { - procname=ep_strdup_printf("proc-%u", proc); + procname=wmem_strdup_printf(wmem_packet_scope(), "proc-%u", proc); } } else { #if 0 dissect_function = NULL; #endif - procname=ep_strdup_printf("proc-%u", proc); + procname=wmem_strdup_printf(wmem_packet_scope(), "proc-%u", proc); } /* @@ -3275,7 +3274,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo, * We must remember this fragment. */ - rfk = se_new(rpc_fragment_key); + rfk = wmem_new(wmem_file_scope(), rpc_fragment_key); rfk->conv_id = conversation->index; rfk->seq = seq; rfk->port = pinfo->srcport; @@ -3298,7 +3297,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo, * set on it. */ if (ipfd_head == NULL) { - new_rfk = se_new(rpc_fragment_key); + new_rfk = wmem_new(wmem_file_scope(), rpc_fragment_key); new_rfk->conv_id = rfk->conv_id; new_rfk->seq = seq + len; new_rfk->port = pinfo->srcport; @@ -3364,7 +3363,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo, * RPC fragments aren't guaranteed to be provided * in order, either. */ - new_rfk = se_new(rpc_fragment_key); + new_rfk = wmem_new(wmem_file_scope(), rpc_fragment_key); new_rfk->conv_id = rfk->conv_id; new_rfk->seq = seq + len; new_rfk->port = pinfo->srcport; @@ -4070,6 +4069,8 @@ proto_register_rpc(void) */ rpc_progs = g_hash_table_new(rpc_prog_hash, rpc_prog_equal); rpc_procs = g_hash_table_new(rpc_proc_hash, rpc_proc_equal); + + authgss_contexts=wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } void @@ -4093,8 +4094,6 @@ proto_reg_handoff_rpc(void) gssapi_handle = find_dissector("gssapi"); spnego_krb5_wrap_handle = find_dissector("spnego-krb5-wrap"); data_handle = find_dissector("data"); - - authgss_contexts=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "gss_contexts"); } /* diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c index 7cd445985f..43f97b28ae 100644 --- a/epan/dissectors/packet-sua.c +++ b/epan/dissectors/packet-sua.c @@ -39,7 +39,7 @@ #include "packet-mtp3.h" #include "packet-sccp.h" -#include <epan/emem.h> +#include <epan/wmem/wmem.h> #define ADD_PADDING(x) ((((x) + 3) >> 2) << 2) #define SCTP_PORT_SUA 14001 @@ -394,7 +394,7 @@ typedef struct _sua_assoc_info_t { gboolean has_fw_key; } sua_assoc_info_t; -static emem_tree_t* assocs = NULL; +static wmem_tree_t* assocs = NULL; sua_assoc_info_t* assoc; sua_assoc_info_t no_sua_assoc = { 0, /* assoc_id */ @@ -411,7 +411,7 @@ sua_assoc_info_t no_sua_assoc = { static sua_assoc_info_t * new_assoc(guint32 calling, guint32 called) { - sua_assoc_info_t *a = se_new0(sua_assoc_info_t); + sua_assoc_info_t *a = wmem_new0(wmem_file_scope(), sua_assoc_info_t); a->assoc_id = next_assoc_id++; a->calling_routing_ind = 0; @@ -440,16 +440,16 @@ sua_assoc(packet_info* pinfo, address* opc, address* dpc, guint src_rn, guint ds case MESSAGE_TYPE_CORE: { /* Calling and called is seen from initiator of CORE */ - emem_tree_key_t bw_key[] = { + wmem_tree_key_t bw_key[] = { {1, &dpck}, {1, &opck}, {1, &src_rn}, {0, NULL} }; - if ( !(assoc = (sua_assoc_info_t *)se_tree_lookup32_array(assocs,bw_key)) && ! pinfo->fd->flags.visited) { + if ( !(assoc = (sua_assoc_info_t *)wmem_tree_lookup32_array(assocs,bw_key)) && ! pinfo->fd->flags.visited) { assoc = new_assoc(opck, dpck); - se_tree_insert32_array(assocs,bw_key,assoc); + wmem_tree_insert32_array(assocs,bw_key,assoc); assoc->has_bw_key = TRUE; /*g_warning("CORE dpck %u,opck %u,src_rn %u",dpck,opck,src_rn);*/ } @@ -460,23 +460,23 @@ sua_assoc(packet_info* pinfo, address* opc, address* dpc, guint src_rn, guint ds case MESSAGE_TYPE_COAK: { /* Calling and called is seen from initiator of CORE */ - emem_tree_key_t fw_key[] = { + wmem_tree_key_t fw_key[] = { {1,&dpck}, {1,&opck}, {1,&src_rn}, {0,NULL} }; - emem_tree_key_t bw_key[] = { + wmem_tree_key_t bw_key[] = { {1,&opck}, {1,&dpck}, {1,&dst_rn}, {0,NULL} }; /*g_warning("MESSAGE_TYPE_COAK dst_rn %u,src_rn %u ",dst_rn,src_rn);*/ - if ( ( assoc = (sua_assoc_info_t *)se_tree_lookup32_array(assocs, bw_key) ) ) { + if ( ( assoc = (sua_assoc_info_t *)wmem_tree_lookup32_array(assocs, bw_key) ) ) { goto got_assoc; } - if ( (assoc = (sua_assoc_info_t *)se_tree_lookup32_array(assocs, fw_key) ) ) { + if ( (assoc = (sua_assoc_info_t *)wmem_tree_lookup32_array(assocs, fw_key) ) ) { goto got_assoc; } @@ -487,12 +487,12 @@ got_assoc: pinfo->p2p_dir = P2P_DIR_RECV; if ( ! pinfo->fd->flags.visited && ! assoc->has_bw_key ) { - se_tree_insert32_array(assocs, bw_key, assoc); + wmem_tree_insert32_array(assocs, bw_key, assoc); assoc->has_bw_key = TRUE; } if ( ! pinfo->fd->flags.visited && ! assoc->has_fw_key ) { - se_tree_insert32_array(assocs, fw_key, assoc); + wmem_tree_insert32_array(assocs, fw_key, assoc); assoc->has_fw_key = TRUE; } @@ -501,13 +501,13 @@ got_assoc: default: { - emem_tree_key_t key[] = { + wmem_tree_key_t key[] = { {1, &opck}, {1, &dpck}, {1, &dst_rn}, {0, NULL} }; - assoc = (sua_assoc_info_t *)se_tree_lookup32_array(assocs,key); + assoc = (sua_assoc_info_t *)wmem_tree_lookup32_array(assocs,key); /* Should a check be made on pinfo->p2p_dir ??? */ break; } @@ -1375,7 +1375,7 @@ dissect_global_title_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tr guint8 number_of_digits; char *gt_digits; - gt_digits = (char *)ep_alloc0(GT_MAX_SIGNALS+1); + gt_digits = (char *)wmem_alloc0(wmem_packet_scope(), GT_MAX_SIGNALS+1); global_title_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - (PARAMETER_HEADER_LENGTH + RESERVED_3_LENGTH + GTI_LENGTH + NO_OF_DIGITS_LENGTH + TRANSLATION_TYPE_LENGTH + NUMBERING_PLAN_LENGTH + NATURE_OF_ADDRESS_LENGTH); @@ -2144,8 +2144,8 @@ dissect_sua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *sua_t no_sua_assoc.has_bw_key = FALSE; no_sua_assoc.has_fw_key = FALSE; - sua_opc = ep_new0(mtp3_addr_pc_t); - sua_dpc = ep_new0(mtp3_addr_pc_t); + sua_opc = wmem_new0(pinfo->pool, mtp3_addr_pc_t); + sua_dpc = wmem_new0(pinfo->pool, mtp3_addr_pc_t); sua_source_gt = NULL; sua_destination_gt = NULL; @@ -2456,7 +2456,7 @@ proto_register_sua(void) sua_parameter_table = register_dissector_table("sua.prop.tags", "Proprietary SUA Tags", FT_UINT16, BASE_DEC); sua_tap = register_tap("sua"); - assocs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "sua_associations"); + assocs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } void |