Replace some emem with wmem.
authorEvan Huus <eapache@gmail.com>
Sun, 25 Aug 2013 14:23:13 +0000 (14:23 -0000)
committerEvan Huus <eapache@gmail.com>
Sun, 25 Aug 2013 14:23:13 +0000 (14:23 -0000)
svn path=/trunk/; revision=51512

epan/dissectors/packet-enip.c
epan/dissectors/packet-k12.c
epan/dissectors/packet-mp2t.c
epan/dissectors/packet-nbd.c
epan/dissectors/packet-rtmpt.c
epan/dissectors/packet-sccp.c

index 88d1a9d63b1e76b61c1a582f120bfbc7129eadc5..86deaf59dcba253bb62ca62ce8e73bc72983b02e 100644 (file)
@@ -40,7 +40,7 @@
 #include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/conversation.h>
 #include <epan/prefs.h>
 #include <epan/etypes.h>
@@ -662,7 +662,7 @@ typedef struct enip_request_key {
 } enip_request_key_t;
 
 typedef struct enip_request_val {
-   emem_tree_t *frames;
+   wmem_tree_t *frames;
 } enip_request_val_t;
 
 /*
@@ -733,24 +733,24 @@ enip_match_request( packet_info *pinfo, proto_tree *tree, enip_request_key_t *pr
       {
          if ( request_val == NULL )
          {
-            new_request_key = (enip_request_key_t *)se_memdup(prequest_key, sizeof(enip_request_key_t));
+            new_request_key = (enip_request_key_t *)wmem_memdup(wmem_file_scope(), prequest_key, sizeof(enip_request_key_t));
 
-            request_val = se_new(enip_request_val_t);
-            request_val->frames = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "enip_frames");
+            request_val = wmem_new(wmem_file_scope(), enip_request_val_t);
+            request_val->frames = wmem_tree_new(wmem_file_scope());
 
             g_hash_table_insert(enip_request_hashtable, new_request_key, request_val );
          }
 
-         request_info = se_new(enip_request_info_t);
+         request_info = wmem_new(wmem_file_scope(), enip_request_info_t);
          request_info->req_num = pinfo->fd->num;
          request_info->rep_num = 0;
          request_info->req_time = pinfo->fd->abs_ts;
          request_info->cip_info = NULL;
-         se_tree_insert32(request_val->frames, pinfo->fd->num, (void *)request_info);
+         wmem_tree_insert32(request_val->frames, pinfo->fd->num, (void *)request_info);
       }
       if( request_val && prequest_key && prequest_key->requesttype == ENIP_RESPONSE_PACKET )
       {
-         request_info = (enip_request_info_t*)se_tree_lookup32_le( request_val->frames, pinfo->fd->num );
+         request_info = (enip_request_info_t*)wmem_tree_lookup32_le( request_val->frames, pinfo->fd->num );
          if ( request_info )
          {
             request_info->rep_num = pinfo->fd->num;
@@ -760,7 +760,7 @@ enip_match_request( packet_info *pinfo, proto_tree *tree, enip_request_key_t *pr
    else
    {
       if ( request_val )
-         request_info = (enip_request_info_t*)se_tree_lookup32_le( request_val->frames, pinfo->fd->num );
+         request_info = (enip_request_info_t*)wmem_tree_lookup32_le( request_val->frames, pinfo->fd->num );
    }
 
    if ( tree && request_info )
@@ -829,8 +829,8 @@ typedef struct enip_conn_val {
 } enip_conn_val_t;
 
 typedef struct _enip_conv_info_t {
-   emem_tree_t *O2TConnIDs;
-   emem_tree_t *T2OConnIDs;
+   wmem_tree_t *O2TConnIDs;
+   wmem_tree_t *T2OConnIDs;
 } enip_conv_info_t;
 
 static GHashTable *enip_conn_hashtable = NULL;
@@ -876,7 +876,7 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
    if (pinfo->fd->flags.visited)
       return;
 
-   conn_key = se_new(enip_conn_key_t);
+   conn_key = wmem_new(wmem_file_scope(), enip_conn_key_t);
    conn_key->ConnSerialNumber = connInfo->ConnSerialNumber;
    conn_key->VendorID = connInfo->VendorID;
    conn_key->DeviceSerialNumber = connInfo->DeviceSerialNumber;
@@ -886,7 +886,7 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
    conn_val = (enip_conn_val_t *)g_hash_table_lookup( enip_conn_hashtable, conn_key );
    if ( conn_val == NULL )
    {
-      conn_val = se_new(enip_conn_val_t);
+      conn_val = wmem_new(wmem_file_scope(), enip_conn_val_t);
 
       conn_val->ConnSerialNumber       = connInfo->ConnSerialNumber;
       conn_val->VendorID               = connInfo->VendorID;
@@ -950,15 +950,13 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
          enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversation, proto_enip);
          if (enip_info == NULL)
          {
-            enip_info = se_new(enip_conv_info_t);
-            enip_info->O2TConnIDs = se_tree_create_non_persistent(
-                     EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
-            enip_info->T2OConnIDs = se_tree_create_non_persistent(
-                        EMEM_TREE_TYPE_RED_BLACK, "enip_T2O");
+            enip_info = wmem_new(wmem_file_scope(), enip_conv_info_t);
+            enip_info->O2TConnIDs = wmem_tree_new(wmem_file_scope());
+            enip_info->T2OConnIDs = wmem_tree_new(wmem_file_scope());
 
             conversation_add_proto_data(conversation, proto_enip, enip_info);
          }
-         se_tree_insert32(enip_info->O2TConnIDs, connInfo->O2T.connID, (void *)conn_val);
+         wmem_tree_insert32(enip_info->O2TConnIDs, connInfo->O2T.connID, (void *)conn_val);
 
          /* Check if separate T->O conversation is necessary.  If either side is multicast
             or ports aren't equal, a separate conversation must be generated */
@@ -974,14 +972,12 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
          enip_info = (enip_conv_info_t *)conversation_get_proto_data(conversationTO, proto_enip);
          if (enip_info == NULL)
          {
-            enip_info = se_new(enip_conv_info_t);
-            enip_info->O2TConnIDs = se_tree_create_non_persistent(
-                     EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
-            enip_info->T2OConnIDs = se_tree_create_non_persistent(
-                     EMEM_TREE_TYPE_RED_BLACK, "enip_T2O");
+            enip_info = wmem_new(wmem_file_scope(), enip_conv_info_t);
+            enip_info->O2TConnIDs = wmem_tree_new(wmem_file_scope());
+            enip_info->T2OConnIDs = wmem_tree_new(wmem_file_scope());
             conversation_add_proto_data(conversationTO, proto_enip, enip_info);
          }
-         se_tree_insert32(enip_info->T2OConnIDs, connInfo->T2O.connID, (void *)conn_val);
+         wmem_tree_insert32(enip_info->T2OConnIDs, connInfo->T2O.connID, (void *)conn_val);
       }
       else
       {
@@ -996,16 +992,14 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
              * No.  Attach that information to the conversation, and add
              * it to the list of information structures.
              */
-            enip_info = se_new(enip_conv_info_t);
-            enip_info->O2TConnIDs = se_tree_create_non_persistent(
-                     EMEM_TREE_TYPE_RED_BLACK, "enip_O2T");
-            enip_info->T2OConnIDs = se_tree_create_non_persistent(
-                     EMEM_TREE_TYPE_RED_BLACK, "enip_T2O");
+            enip_info = wmem_new(wmem_file_scope(), enip_conv_info_t);
+            enip_info->O2TConnIDs = wmem_tree_new(wmem_file_scope());
+            enip_info->T2OConnIDs = wmem_tree_new(wmem_file_scope());
 
             conversation_add_proto_data(conversation, proto_enip, enip_info);
          }
-         se_tree_insert32(enip_info->O2TConnIDs, connInfo->O2T.connID, (void *)conn_val);
-         se_tree_insert32(enip_info->T2OConnIDs, connInfo->T2O.connID, (void *)conn_val);
+         wmem_tree_insert32(enip_info->O2TConnIDs, connInfo->O2T.connID, (void *)conn_val);
+         wmem_tree_insert32(enip_info->T2OConnIDs, connInfo->T2O.connID, (void *)conn_val);
       }
    }
 }
@@ -1066,15 +1060,15 @@ enip_get_explicit_connid(packet_info *pinfo, enip_request_key_t *prequest_key, g
    switch ( prequest_key->requesttype )
    {
    case ENIP_REQUEST_PACKET:
-      conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
+      conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->O2TConnIDs, connid );
       if ( conn_val == NULL )
-         conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid );
+         conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->T2OConnIDs, connid );
       break;
 
    case ENIP_RESPONSE_PACKET:
-      conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid );
+      conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->T2OConnIDs, connid );
       if ( conn_val == NULL )
-         conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
+         conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->O2TConnIDs, connid );
       break;
    case ENIP_CANNOT_CLASSIFY:
       /* ignore */
@@ -1114,13 +1108,13 @@ enip_get_io_connid(packet_info *pinfo, guint32 connid, enum enip_connid_type* pc
       return NULL;
 
    if (enip_info->O2TConnIDs != NULL)
-      conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->O2TConnIDs, connid );
+      conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->O2TConnIDs, connid );
 
    if ( conn_val == NULL )
    {
       if (enip_info->T2OConnIDs != NULL)
       {
-         if ((conn_val = (enip_conn_val_t *)se_tree_lookup32( enip_info->T2OConnIDs, connid)) != NULL)
+         if ((conn_val = (enip_conn_val_t *)wmem_tree_lookup32( enip_info->T2OConnIDs, connid)) != NULL)
             *pconnid_type = ECIDT_T2O;
       }
    }
@@ -1752,7 +1746,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
                          if (conn_info->safety.safety_seg == TRUE)
                          {
                             /* Add any possible safety related data */
-                            cip_safety = se_new(cip_safety_info_t);
+                            cip_safety = wmem_new(wmem_file_scope(), cip_safety_info_t);
                             cip_safety->conn_type = connid_type;
                             cip_safety->server_dir = (conn_info->TransportClass_trigger & CI_PRODUCTION_DIR_MASK) ? TRUE : FALSE;
                             cip_safety->format = conn_info->safety.format;
@@ -1908,14 +1902,14 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
                      {
                         request_info->cip_info->connInfo->O2T.port = tvb_get_ntohs(tvb, offset+8);
                         request_info->cip_info->connInfo->O2T.ipaddress.type = AT_IPv4;
-                        request_info->cip_info->connInfo->O2T.ipaddress.data = se_alloc(sizeof(guint32));
+                        request_info->cip_info->connInfo->O2T.ipaddress.data = wmem_alloc(wmem_file_scope(), sizeof(guint32));
                         *((guint32*)request_info->cip_info->connInfo->O2T.ipaddress.data) = tvb_get_ipv4(tvb, offset+10);
                      }
                      else
                      {
                         request_info->cip_info->connInfo->T2O.port = tvb_get_ntohs(tvb, offset+8);
                         request_info->cip_info->connInfo->T2O.ipaddress.type = AT_IPv4;
-                        request_info->cip_info->connInfo->T2O.ipaddress.data = se_alloc(sizeof(guint32));
+                        request_info->cip_info->connInfo->T2O.ipaddress.data = wmem_alloc(wmem_file_scope(), sizeof(guint32));
                         *((guint32*)request_info->cip_info->connInfo->T2O.ipaddress.data) = tvb_get_ipv4(tvb, offset+10);
                      }
                   }
index fd3f7aeb7c5e044352bd47bcf954be0f1bdb7206..f7c5c1d52d42ef0f789438d3bd455172479de8f4 100644 (file)
@@ -33,6 +33,7 @@
 #include <epan/conversation.h>
 #include <prefs.h>
 #include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/uat.h>
 #include <epan/expert.h>
 #include <epan/strutil.h>
@@ -71,7 +72,7 @@ static dissector_handle_t fp_handle;
 extern int proto_sscop;
 extern int proto_fp;
 
-static emem_tree_t* port_handles = NULL;
+static wmem_tree_t* port_handles = NULL;
 static uat_t* k12_uat = NULL;
 static k12_handles_t* k12_handles = NULL;
 static guint nk12_handles = 0;
@@ -212,7 +213,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
                        break;
                case K12_PORT_ATMPVC:
                {
-               gchar* circuit_str = ep_strdup_printf("%u:%u:%u",
+               gchar* circuit_str = wmem_strdup_printf(wmem_packet_scope(), "%u:%u:%u",
                                                      (guint)pinfo->pseudo_header->k12.input_info.atm.vp,
                                                      (guint)pinfo->pseudo_header->k12.input_info.atm.vc,
                                                      (guint)pinfo->pseudo_header->k12.input_info.atm.cid);
@@ -236,7 +237,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
                        break;
        }
 
-       handles = (dissector_handle_t *)se_tree_lookup32(port_handles, pinfo->pseudo_header->k12.input);
+       handles = (dissector_handle_t *)wmem_tree_lookup32(port_handles, pinfo->pseudo_header->k12.input);
 
        if (! handles ) {
                for (i=0 ; i < nk12_handles; i++) {
@@ -252,7 +253,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
                        handles = data_handles;
                }
 
-               se_tree_insert32(port_handles, pinfo->pseudo_header->k12.input, handles);
+               wmem_tree_insert32(port_handles, pinfo->pseudo_header->k12.input, handles);
 
        }
 
@@ -276,7 +277,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
                if (handles[i] == sscop_handle) {
                        sscop_payload_info *p_sscop_info = (sscop_payload_info *)p_get_proto_data(pinfo->fd, proto_sscop, 0);
                        if (!p_sscop_info) {
-                               p_sscop_info = se_new0(sscop_payload_info);
+                               p_sscop_info = wmem_new0(wmem_file_scope(), sscop_payload_info);
                 p_add_proto_data(pinfo->fd, proto_sscop, 0, p_sscop_info);
                 p_sscop_info->subdissector = handles[i+1];
                        }
@@ -290,7 +291,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
        if (sub_handle == fp_handle) {
                fp_info *p_fp_info = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
                if (!p_fp_info) {
-                       p_fp_info = se_new0(fp_info);
+                       p_fp_info = wmem_new0(wmem_file_scope(), fp_info);
             p_add_proto_data(pinfo->fd, proto_fp, 0, p_fp_info);
 
             fill_fp_info(p_fp_info,
@@ -477,6 +478,6 @@ proto_register_k12(void)
                                "A table of matches vs stack filenames and relative protocols",
                                k12_uat);
 
-  port_handles = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "k12_port_handles");
+  port_handles = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
 
 }
index 63140a36f0f2c3045efc4db7a94abf54f05036fe..ed1b7fa009ae0a1db1200316a050f5a49defdf34 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <epan/rtp_pt.h>
 
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/conversation.h>
 #include <epan/expert.h>
 #include <epan/reassemble.h>
@@ -277,7 +277,7 @@ typedef struct mp2t_analysis_data {
         * individual pid's, this is only used when packets are
         * processed sequencially.
         */
-       emem_tree_t     *pid_table;
+       wmem_tree_t     *pid_table;
 
        /* When detecting a CC drop, store that information for the
         * given frame.  This info is needed, when clicking around in
@@ -286,7 +286,7 @@ typedef struct mp2t_analysis_data {
         * used to tell the difference.
         *
         */
-       emem_tree_t     *frame_table;
+       wmem_tree_t     *frame_table;
 
        /* Total counters per conversation / multicast stream */
        guint32 total_skips;
@@ -312,7 +312,7 @@ typedef struct subpacket_analysis_data {
 typedef struct packet_analysis_data {
 
        /* Contain information for each MPEG2-TS packet in the current big packet */
-       emem_tree_t *subpacket_table;
+       wmem_tree_t *subpacket_table;
 } packed_analysis_data_t;
 
 /* Analysis TS frame info needed during sequential processing */
@@ -341,7 +341,7 @@ typedef struct frame_analysis_data {
        /* As each frame has several pid's, thus need a pid data
         * structure per TS frame.
         */
-       emem_tree_t     *ts_table;
+       wmem_tree_t     *ts_table;
 
 } frame_analysis_data_t;
 
@@ -350,14 +350,11 @@ init_mp2t_conversation_data(void)
 {
        mp2t_analysis_data_t *mp2t_data = NULL;
 
-       mp2t_data = se_new0(struct mp2t_analysis_data);
+       mp2t_data = wmem_new0(wmem_file_scope(), struct mp2t_analysis_data);
 
-       mp2t_data->pid_table =
-               se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
-                                             "mp2t_pid_table");
-       mp2t_data->frame_table =
-               se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
-                                             "mp2t_frame_table");
+       mp2t_data->pid_table = wmem_tree_new(wmem_file_scope());
+
+       mp2t_data->frame_table = wmem_tree_new(wmem_file_scope());
 
        mp2t_data->total_skips = 0;
        mp2t_data->total_discontinuity = 0;
@@ -384,12 +381,10 @@ init_frame_analysis_data(mp2t_analysis_data_t *mp2t_data, packet_info *pinfo)
 {
        frame_analysis_data_t *frame_analysis_data_p = NULL;
 
-       frame_analysis_data_p = se_new0(struct frame_analysis_data);
-       frame_analysis_data_p->ts_table =
-               se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK,
-                                       "mp2t_frame_pid_table");
+       frame_analysis_data_p = wmem_new0(wmem_file_scope(), struct frame_analysis_data);
+       frame_analysis_data_p->ts_table = wmem_tree_new(wmem_file_scope());
        /* Insert into mp2t tree */
-       se_tree_insert32(mp2t_data->frame_table, pinfo->fd->num,
+       wmem_tree_insert32(mp2t_data->frame_table, pinfo->fd->num,
                         (void *)frame_analysis_data_p);
 
        return frame_analysis_data_p;
@@ -400,7 +395,7 @@ static frame_analysis_data_t *
 get_frame_analysis_data(mp2t_analysis_data_t *mp2t_data, packet_info *pinfo)
 {
        frame_analysis_data_t *frame_analysis_data_p = NULL;
-       frame_analysis_data_p = (frame_analysis_data_t *)se_tree_lookup32(mp2t_data->frame_table, pinfo->fd->num);
+       frame_analysis_data_p = (frame_analysis_data_t *)wmem_tree_lookup32(mp2t_data->frame_table, pinfo->fd->num);
        return frame_analysis_data_p;
 }
 
@@ -413,14 +408,14 @@ get_pid_analysis(guint32 pid, conversation_t *conv)
 
        mp2t_data = get_mp2t_conversation_data(conv);
 
-       pid_data = (pid_analysis_data_t *)se_tree_lookup32(mp2t_data->pid_table, pid);
+       pid_data = (pid_analysis_data_t *)wmem_tree_lookup32(mp2t_data->pid_table, pid);
        if (!pid_data) {
-               pid_data          = se_new0(struct pid_analysis_data);
+               pid_data          = wmem_new0(wmem_file_scope(), struct pid_analysis_data);
                pid_data->cc_prev = -1;
                pid_data->pid     = pid;
                pid_data->frag_id = (pid << (32 - 13)) | 0x1;
 
-               se_tree_insert32(mp2t_data->pid_table, pid, (void *)pid_data);
+               wmem_tree_insert32(mp2t_data->pid_table, pid, (void *)pid_data);
        }
        return pid_data;
 }
@@ -641,22 +636,22 @@ mp2t_process_fragmented_payload(tvbuff_t *tvb, gint offset, guint remaining_len,
                frag_id = pid_analysis->frag_id;
                pdata = (packed_analysis_data_t *)p_get_proto_data(pinfo->fd, proto_mp2t, 0);
                if (!pdata) {
-                       pdata = se_new0(packed_analysis_data_t);
-                       pdata->subpacket_table = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "mp2t_frame_table");
+                       pdata = wmem_new0(wmem_file_scope(), packed_analysis_data_t);
+                       pdata->subpacket_table = wmem_tree_new(wmem_file_scope());
                        p_add_proto_data(pinfo->fd, proto_mp2t, 0, pdata);
 
                } else {
-                       spdata = (subpacket_analysis_data_t *)se_tree_lookup32(pdata->subpacket_table, offset);
+                       spdata = (subpacket_analysis_data_t *)wmem_tree_lookup32(pdata->subpacket_table, offset);
                }
 
                if (!spdata) {
-                       spdata = se_new0(subpacket_analysis_data_t);
+                       spdata = wmem_new0(wmem_file_scope(), subpacket_analysis_data_t);
                        /* Save the info into pdata from pid_analysis */
                        spdata->frag_cur_pos = frag_cur_pos;
                        spdata->frag_tot_len = frag_tot_len;
                        spdata->fragmentation = fragmentation;
                        spdata->frag_id = frag_id;
-                       se_tree_insert32(pdata->subpacket_table, offset, (void *)spdata);
+                       wmem_tree_insert32(pdata->subpacket_table, offset, (void *)spdata);
 
                }
 
@@ -668,7 +663,7 @@ mp2t_process_fragmented_payload(tvbuff_t *tvb, gint offset, guint remaining_len,
                        return;
                }
 
-               spdata = (subpacket_analysis_data_t *)se_tree_lookup32(pdata->subpacket_table, offset);
+               spdata = (subpacket_analysis_data_t *)wmem_tree_lookup32(pdata->subpacket_table, offset);
                if (!spdata) {
                        /* Occurs for the first sub packets in the capture which cannot be reassembled */
                        return;
@@ -894,11 +889,11 @@ detect_cc_drops(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
                /* Create and store a new TS frame pid_data object.
                   This indicate that we have a drop
                 */
-               ts_data = se_new0(struct ts_analysis_data);
+               ts_data = wmem_new0(wmem_file_scope(), struct ts_analysis_data);
                ts_data->cc_prev = cc_prev;
                ts_data->pid = pid;
                ts_data->skips = skips;
-               se_tree_insert32(frame_analysis_data_p->ts_table, KEY(pid, cc_curr),
+               wmem_tree_insert32(frame_analysis_data_p->ts_table, KEY(pid, cc_curr),
                                 (void *)ts_data);
        }
 
@@ -910,7 +905,7 @@ detect_cc_drops(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
                if (!frame_analysis_data_p)
                        return 0; /* No stored frame data -> no drops*/
                else {
-                       ts_data = (struct ts_analysis_data *)se_tree_lookup32(frame_analysis_data_p->ts_table,
+                       ts_data = (struct ts_analysis_data *)wmem_tree_lookup32(frame_analysis_data_p->ts_table,
                                                   KEY(pid, cc_curr));
 
                        if (ts_data) {
index ccc6e64f1fc042cae534f405741929620899b42b..7c00ff31274624cf04b8e4108624e0dae6d99e16 100644 (file)
@@ -31,7 +31,7 @@
 #include <epan/packet.h>
 #include <epan/prefs.h>
 #include <epan/conversation.h>
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include "packet-tcp.h"
 
 static gint proto_nbd = -1;
@@ -59,8 +59,8 @@ typedef struct _nbd_transaction_t {
        guint8 type;
 } nbd_transaction_t;
 typedef struct _nbd_conv_info_t {
-        emem_tree_t *unacked_pdus;    /* indexed by handle, whichs wraps quite frequently  */
-        emem_tree_t *acked_pdus;    /* indexed by packet# and handle */
+        wmem_tree_t *unacked_pdus;    /* indexed by handle, whichs wraps quite frequently  */
+        wmem_tree_t *acked_pdus;    /* indexed by packet# and handle */
 } nbd_conv_info_t;
 
 
@@ -88,7 +88,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
        conversation_t *conversation;
        nbd_conv_info_t *nbd_info;
        nbd_transaction_t *nbd_trans=NULL;
-       emem_tree_key_t hkey[3];
+       wmem_tree_key_t hkey[3];
        guint32 handle[2];
 
        magic=tvb_get_ntohl(tvb, offset);
@@ -131,7 +131,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
                        hkey[0].length=2;
                        hkey[0].key=handle;
                        hkey[1].length=0;
-                       nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->unacked_pdus, hkey);
+                       nbd_trans=(nbd_transaction_t *)wmem_tree_lookup32_array(nbd_info->unacked_pdus, hkey);
                        if(!nbd_trans){
                                /* No, so just return the rest of the current packet */
                                return tvb_length(tvb);
@@ -148,7 +148,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
                        hkey[1].length=2;
                        hkey[1].key=handle;
                        hkey[2].length=0;
-                       nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->acked_pdus, hkey);
+                       nbd_trans=(nbd_transaction_t *)wmem_tree_lookup32_array(nbd_info->acked_pdus, hkey);
                        if(!nbd_trans){
                                /* No, so just return the rest of the current packet */
                                return tvb_length(tvb);
@@ -182,7 +182,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        conversation_t *conversation;
        nbd_conv_info_t *nbd_info;
        nbd_transaction_t *nbd_trans=NULL;
-       emem_tree_key_t hkey[3];
+       wmem_tree_key_t hkey[3];
 
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBD");
 
@@ -218,16 +218,16 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                /* No.  Attach that information to the conversation, and add
                 * it to the list of information structures.
                 */
-               nbd_info = se_new(nbd_conv_info_t);
-               nbd_info->unacked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_unacked_pdus");
-               nbd_info->acked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_acked_pdus");
+               nbd_info = wmem_new(wmem_file_scope(), nbd_conv_info_t);
+               nbd_info->unacked_pdus = wmem_tree_new(wmem_file_scope());
+               nbd_info->acked_pdus   = wmem_tree_new(wmem_file_scope());
 
                conversation_add_proto_data(conversation, proto_nbd, nbd_info);
        }
        if(!pinfo->fd->flags.visited){
                if(magic==NBD_REQUEST_MAGIC){
                        /* This is a request */
-                       nbd_trans=se_new(nbd_transaction_t);
+                       nbd_trans=wmem_new(wmem_file_scope(), nbd_transaction_t);
                        nbd_trans->req_frame=pinfo->fd->num;
                        nbd_trans->rep_frame=0;
                        nbd_trans->req_time=pinfo->fd->abs_ts;
@@ -238,13 +238,13 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                        hkey[0].key=handle;
                        hkey[1].length=0;
 
-                       se_tree_insert32_array(nbd_info->unacked_pdus, hkey, (void *)nbd_trans);
+                       wmem_tree_insert32_array(nbd_info->unacked_pdus, hkey, (void *)nbd_trans);
                } else if(magic==NBD_RESPONSE_MAGIC){
                        hkey[0].length=2;
                        hkey[0].key=handle;
                        hkey[1].length=0;
 
-                       nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->unacked_pdus, hkey);
+                       nbd_trans=(nbd_transaction_t *)wmem_tree_lookup32_array(nbd_info->unacked_pdus, hkey);
                        if(nbd_trans){
                                nbd_trans->rep_frame=pinfo->fd->num;
 
@@ -253,13 +253,13 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                                hkey[1].length=2;
                                hkey[1].key=handle;
                                hkey[2].length=0;
-                               se_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans);
+                               wmem_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans);
                                hkey[0].length=1;
                                hkey[0].key=&nbd_trans->req_frame;
                                hkey[1].length=2;
                                hkey[1].key=handle;
                                hkey[2].length=0;
-                               se_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans);
+                               wmem_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans);
                        }
                }
        } else {
@@ -270,7 +270,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                hkey[1].key=handle;
                hkey[2].length=0;
 
-               nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->acked_pdus, hkey);
+               nbd_trans=(nbd_transaction_t *)wmem_tree_lookup32_array(nbd_info->acked_pdus, hkey);
        }
        /* The bloody handles are reused !!! eventhough they are 64 bits.
         * So we must verify we got the "correct" one
@@ -284,7 +284,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 
        if(!nbd_trans){
                /* create a "fake" nbd_trans structure */
-               nbd_trans=ep_new(nbd_transaction_t);
+               nbd_trans=wmem_new(wmem_packet_scope(), nbd_transaction_t);
                nbd_trans->req_frame=0;
                nbd_trans->rep_frame=0;
                nbd_trans->req_time=pinfo->fd->abs_ts;
index fbe6a54340e93fa58a4fed933fb60f4735b2acf2..3a481efbe71f043df21d7810c74eb229e85422e5 100644 (file)
@@ -70,7 +70,7 @@
 
 #include <epan/packet.h>
 
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/conversation.h>
 #include <epan/strutil.h>
 #include <epan/prefs.h>
@@ -497,18 +497,18 @@ typedef struct rtmpt_id {
         guint32 src;  /* bytes 8-11 */
         guint8  cmd;  /* byte 7 */
 
-        emem_tree_t *packets;
+        wmem_tree_t *packets;
 } rtmpt_id_t;
 
 /* Historical view of a whole TCP connection
  */
 typedef struct rtmpt_conv {
-        emem_tree_t *seqs[2];
-        emem_tree_t *frags[2];
-        emem_tree_t *ids[2];
-        emem_tree_t *packets[2];
-        emem_tree_t *chunksize[2];
-        emem_tree_t *txids[2];
+        wmem_tree_t *seqs[2];
+        wmem_tree_t *frags[2];
+        wmem_tree_t *ids[2];
+        wmem_tree_t *packets[2];
+        wmem_tree_t *chunksize[2];
+        wmem_tree_t *txids[2];
 } rtmpt_conv_t;
 
 #ifdef DEBUG_RTMPT
@@ -704,7 +704,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
             tp->cmd==RTMPT_TYPE_ACKNOWLEDGEMENT || tp->cmd==RTMPT_TYPE_WINDOW) {
                 if (tp->len>=4 && remain>=4) {
                         *deschasopcode = TRUE;
-                        return ep_strdup_printf("%s %d",
+                        return wmem_strdup_printf(wmem_packet_scope(), "%s %d",
                                                 val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"),
                                                 tvb_get_ntohl(tvb, offset));
                 }
@@ -712,7 +712,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
         } else if (tp->cmd==RTMPT_TYPE_PEER_BANDWIDTH) {
                 if (tp->len>=5 && remain>=5) {
                         *deschasopcode = TRUE;
-                        return ep_strdup_printf("%s %d,%s",
+                        return wmem_strdup_printf(wmem_packet_scope(), "%s %d,%s",
                                                 val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"),
                                                 tvb_get_ntohl(tvb, offset),
                                                 val_to_str(tvb_get_guint8(tvb, offset+4), rtmpt_limit_vals, "Unknown (%d)"));
@@ -729,23 +729,23 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
                 sFunc = try_val_to_str(iUCM, rtmpt_ucm_vals);
                 if (sFunc==NULL) {
                         *deschasopcode = TRUE;
-                        sFunc = ep_strdup_printf("User Control Message 0x%01x", iUCM);
+                        sFunc = wmem_strdup_printf(wmem_packet_scope(), "User Control Message 0x%01x", iUCM);
                 }
 
                 if (iUCM==RTMPT_UCM_STREAM_BEGIN || iUCM==RTMPT_UCM_STREAM_EOF ||
                     iUCM==RTMPT_UCM_STREAM_DRY || iUCM==RTMPT_UCM_STREAM_ISRECORDED) {
                         if (tp->len>=6 && remain>=6) {
-                                sParam = ep_strdup_printf(" %d", tvb_get_ntohl(tvb, offset+2));
+                                sParam = wmem_strdup_printf(wmem_packet_scope(), " %d", tvb_get_ntohl(tvb, offset+2));
                         }
                 } else if (iUCM==RTMPT_UCM_SET_BUFFER) {
                         if (tp->len>=10 && remain>=10) {
-                                sParam = ep_strdup_printf(" %d,%dms",
+                                sParam = wmem_strdup_printf(wmem_packet_scope(), " %d,%dms",
                                                           tvb_get_ntohl(tvb, offset+2),
                                                           tvb_get_ntohl(tvb, offset+6));
                         }
                 }
 
-                return ep_strdup_printf("%s%s", sFunc, sParam);
+                return wmem_strdup_printf(wmem_packet_scope(), "%s%s", sFunc, sParam);
 
         } else if (tp->cmd==RTMPT_TYPE_COMMAND_AMF0 || tp->cmd==RTMPT_TYPE_COMMAND_AMF3 ||
                    tp->cmd==RTMPT_TYPE_DATA_AMF0 || tp->cmd==RTMPT_TYPE_DATA_AMF3) {
@@ -793,7 +793,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
                         }
 
                         if (tp->txid!=0 && tp->otherframe==0) {
-                                tp->otherframe = GPOINTER_TO_INT(se_tree_lookup32(rconv->txids[cdir^1], tp->txid));
+                                tp->otherframe = GPOINTER_TO_INT(wmem_tree_lookup32(rconv->txids[cdir^1], tp->txid));
                                 if (tp->otherframe) {
                                         RTMPT_DEBUG("got otherframe=%d\n", tp->otherframe);
                                 }
@@ -802,9 +802,9 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
 
                 if (sFunc) {
                         if (sParam) {
-                                return ep_strdup_printf("%s('%s')", sFunc, sParam);
+                                return wmem_strdup_printf(wmem_packet_scope(), "%s('%s')", sFunc, sParam);
                         } else {
-                                return ep_strdup_printf("%s()", sFunc);
+                                return wmem_strdup_printf(wmem_packet_scope(), "%s()", sFunc);
                         }
                 }
         }
@@ -1693,7 +1693,7 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
                 if (tp->cmd==RTMPT_TYPE_CHUNK_SIZE && tp->len>=4 && iBodyRemain>=4) {
                         guint32 newchunksize = tvb_get_ntohl(tvb, iBodyOffset);
                         if (newchunksize<rtmpt_max_packet_size) {
-                                se_tree_insert32(rconv->chunksize[cdir], tp->lastseq, GINT_TO_POINTER(newchunksize));
+                                wmem_tree_insert32(rconv->chunksize[cdir], tp->lastseq, GINT_TO_POINTER(newchunksize));
                         }
                 }
 
@@ -1707,7 +1707,7 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
                                 tp->txid = rtmpt_get_amf_txid(tvb, iBodyOffset+soff);
                                 if (tp->txid!=0) {
                                         RTMPT_DEBUG("got txid=%d\n", tp->txid);
-                                        se_tree_insert32(rconv->txids[cdir], tp->txid, GINT_TO_POINTER(pinfo->fd->num));
+                                        wmem_tree_insert32(rconv->txids[cdir], tp->txid, GINT_TO_POINTER(pinfo->fd->num));
                                 }
                         }
                 }
@@ -1876,22 +1876,22 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
 
         if (pinfo->fd->flags.visited) {
                 /* Already done the work, so just dump the existing state */
-                ep_stack_t packets;
+                wmem_stack_t *packets;
 
                 /* List all RTMP packets terminating in this TCP segment, from end to beginning */
 
-                packets = ep_stack_new();
-                ep_stack_push(packets, 0);
+                packets = wmem_stack_new(wmem_packet_scope());
+                wmem_stack_push(packets, 0);
 
-                tp = (rtmpt_packet_t *)se_tree_lookup32_le(rconv->packets[cdir], seq+remain-1);
+                tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(rconv->packets[cdir], seq+remain-1);
                 while (tp && tp->lastseq>=seq) {
-                        ep_stack_push(packets, tp);
-                        tp = (rtmpt_packet_t *)se_tree_lookup32_le(rconv->packets[cdir], tp->lastseq-1);
+                        wmem_stack_push(packets, tp);
+                        tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(rconv->packets[cdir], tp->lastseq-1);
                 }
 
                 /* Dissect the generated list in reverse order (beginning to end) */
 
-                while ((tp=(rtmpt_packet_t *)ep_stack_pop(packets))!=NULL) {
+                while ((tp=(rtmpt_packet_t *)wmem_stack_pop(packets))!=NULL) {
                         if (tp->resident) {
                                 pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
                                 add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
@@ -1912,7 +1912,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                 /* Check for outstanding fragmented headers/chunks first */
 
                 if (offset==0) {
-                        tf = (rtmpt_frag_t *)se_tree_lookup32_le(rconv->frags[cdir], seq+offset-1);
+                        tf = (rtmpt_frag_t *)wmem_tree_lookup32_le(rconv->frags[cdir], seq+offset-1);
 
                         if (tf) {
                                 /* May need to reassemble cross-TCP-segment fragments */
@@ -1920,8 +1920,8 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                                 if (tf->have>=tf->len || seq+offset<tf->seq || seq+offset>tf->lastseq+tf->len-tf->have) {
                                         tf = NULL;
                                 } else if (!tf->ishdr) {
-                                        ti = (rtmpt_id_t *)se_tree_lookup32(rconv->ids[cdir], tf->saved.id);
-                                        if (ti) tp = (rtmpt_packet_t *)se_tree_lookup32_le(ti->packets, seq+offset-1);
+                                        ti = (rtmpt_id_t *)wmem_tree_lookup32(rconv->ids[cdir], tf->saved.id);
+                                        if (ti) tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(ti->packets, seq+offset-1);
                                         if (tp && tp->chunkwant) {
                                                 goto unchunk;
                                         }
@@ -1987,14 +1987,14 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
 
                                 if (remain<basic_hlen+message_hlen) {
                                         /* Ran out of packet mid-header, save and try again next time */
-                                        tf = se_new(rtmpt_frag_t);
+                                        tf = wmem_new(wmem_file_scope(), rtmpt_frag_t);
                                         tf->ishdr = 1;
                                         tf->seq = seq + offset;
                                         tf->lastseq = tf->seq + remain - 1;
                                         tf->len = basic_hlen + message_hlen;
                                         tvb_memcpy(tvb, tf->saved.d, offset, remain);
                                         tf->have = remain;
-                                        se_tree_insert32(rconv->frags[cdir], seq+offset, tf);
+                                        wmem_tree_insert32(rconv->frags[cdir], seq+offset, tf);
                                         return;
                                 }
 
@@ -2017,8 +2017,8 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
 
                 /* Calculate header values, defaulting from previous packets with same id */
 
-                if (id<=RTMPT_ID_MAX) ti = (rtmpt_id_t *)se_tree_lookup32(rconv->ids[cdir], id);
-                if (ti) tp = (rtmpt_packet_t *)se_tree_lookup32_le(ti->packets, seq+offset-1);
+                if (id<=RTMPT_ID_MAX) ti = (rtmpt_id_t *)wmem_tree_lookup32(rconv->ids[cdir], id);
+                if (ti) tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(ti->packets, seq+offset-1);
 
                 if (header_type==0) src = tf ? pntohl(tf->saved.d+basic_hlen+7) : tvb_get_ntohl(tvb, offset+basic_hlen+7);
                 else if (ti) src = ti->src;
@@ -2034,7 +2034,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                         else if (id==RTMPT_TYPE_HANDSHAKE_2) chunk_size = body_len = 3072;
                         else /* if (id==RTMPT_TYPE_HANDSHAKE_3) */ chunk_size = body_len = 1536;
                 } else {
-                        chunk_size = GPOINTER_TO_INT(se_tree_lookup32_le(rconv->chunksize[cdir], seq+offset-1));
+                        chunk_size = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->chunksize[cdir], seq+offset-1));
                         if (!chunk_size) chunk_size = RTMPT_DEFAULT_CHUNK_SIZE;
 
                         if (header_type<2) body_len = tf ? pntoh24(tf->saved.d+basic_hlen+3) : tvb_get_ntoh24(tvb, offset+basic_hlen+3);
@@ -2058,11 +2058,11 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                                     ti, tp, header_type, basic_hlen+message_hlen, id, tp?tp->have:0, tp?tp->want:0, body_len, chunk_size);
 
                         if (!ti) {
-                                ti = se_new(rtmpt_id_t);
-                                ti->packets = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_packets");
+                                ti = wmem_new(wmem_file_scope(), rtmpt_id_t);
+                                ti->packets = wmem_tree_new(wmem_file_scope());
                                 ti->ts = 0;
                                 ti->tsd = 0;
-                                se_tree_insert32(rconv->ids[cdir], id, ti);
+                                wmem_tree_insert32(rconv->ids[cdir], id, ti);
                         }
 
                         if (header_type==0) {
@@ -2085,7 +2085,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                         }
 
                         /* create a new packet structure */
-                        tp = se_new(rtmpt_packet_t);
+                        tp = wmem_new(wmem_file_scope(), rtmpt_packet_t);
                         tp->seq = tp->lastseq = tf ? tf->seq : seq+offset;
                         tp->have = 0;
                         tp->want = basic_hlen + message_hlen + body_len;
@@ -2112,7 +2112,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                         ti->src = src;
 
                         /* store against the id only until unchunking is complete */
-                        se_tree_insert32(ti->packets, tp->seq, tp);
+                        wmem_tree_insert32(ti->packets, tp->seq, tp);
 
                         if (!tf && body_len<=chunk_size && tp->want<=remain) {
                                 /* The easy case - a whole packet contiguous and fully within this segment */
@@ -2121,7 +2121,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                                 tp->lastseq = seq+offset+tp->want-1;
                                 tp->have = tp->want;
 
-                                se_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
+                                wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
 
                                 pktbuf = tvb_new_subset(tvb, tp->data.offset, tp->have, tp->have);
                                 dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
@@ -2133,7 +2133,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                         } else {
                                 /* Some more reassembly required */
                                 tp->resident = TRUE;
-                                tp->data.p = (guint8 *)se_alloc(tp->bhlen+tp->mhlen+tp->len);
+                                tp->data.p = (guint8 *)wmem_alloc(wmem_file_scope(), tp->bhlen+tp->mhlen+tp->len);
 
                                 if (tf && tf->ishdr) {
                                         memcpy(tp->data.p, tf->saved.d, tf->len);
@@ -2147,7 +2147,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                                 tp->have = basic_hlen + message_hlen;
 
                                 if (tp->have==tp->want) {
-                                        se_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
+                                        wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
 
                                         pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
                                         add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
@@ -2199,14 +2199,14 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
 
                 if (tp->have==tp->want) {
                         /* Whole packet is complete */
-                        se_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
+                        wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
 
                         pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
                         add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
                         dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
                 } else if (tp->chunkhave<tp->chunkwant) {
                         /* Chunk is split across segment boundary */
-                        rtmpt_frag_t *tf2 = se_new(rtmpt_frag_t);
+                        rtmpt_frag_t *tf2 = wmem_new(wmem_file_scope(), rtmpt_frag_t);
                         tf2->ishdr = 0;
                         tf2->seq = seq + offset - want;
                         tf2->lastseq = tf2->seq + remain - 1 + want;
@@ -2214,7 +2214,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
                         tf2->len = tp->chunkwant;
                         tf2->saved.id = tp->id;
                         RTMPT_DEBUG("  inserting tf @ %d\n", seq+offset-want-1);
-                        se_tree_insert32(rconv->frags[cdir], seq+offset-want-1, tf2);
+                        wmem_tree_insert32(rconv->frags[cdir], seq+offset-want-1, tf2);
                 }
         }
 }
@@ -2222,21 +2222,21 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
 static rtmpt_conv_t*
 rtmpt_init_rconv(conversation_t *conv)
 {
-        rtmpt_conv_t *rconv = se_new(rtmpt_conv_t);
+        rtmpt_conv_t *rconv = wmem_new(wmem_file_scope(), rtmpt_conv_t);
         conversation_add_proto_data(conv, proto_rtmpt, rconv);
 
-        rconv->seqs[0]      = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_seqs0");
-        rconv->seqs[1]      = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_seqs1");
-        rconv->frags[0]     = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_frags0");
-        rconv->frags[1]     = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_frags1");
-        rconv->ids[0]       = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_ids0");
-        rconv->ids[1]       = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_ids1");
-        rconv->packets[0]   = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_packets0");
-        rconv->packets[1]   = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_packets1");
-        rconv->chunksize[0] = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_chunksize0");
-        rconv->chunksize[1] = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_chunksize1");
-        rconv->txids[0]     = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_txids0");
-        rconv->txids[1]     = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "rtmpt_txids1");
+        rconv->seqs[0]      = wmem_tree_new(wmem_file_scope());
+        rconv->seqs[1]      = wmem_tree_new(wmem_file_scope());
+        rconv->frags[0]     = wmem_tree_new(wmem_file_scope());
+        rconv->frags[1]     = wmem_tree_new(wmem_file_scope());
+        rconv->ids[0]       = wmem_tree_new(wmem_file_scope());
+        rconv->ids[1]       = wmem_tree_new(wmem_file_scope());
+        rconv->packets[0]   = wmem_tree_new(wmem_file_scope());
+        rconv->packets[1]   = wmem_tree_new(wmem_file_scope());
+        rconv->chunksize[0] = wmem_tree_new(wmem_file_scope());
+        rconv->chunksize[1] = wmem_tree_new(wmem_file_scope());
+        rconv->txids[0]     = wmem_tree_new(wmem_file_scope());
+        rconv->txids[1]     = wmem_tree_new(wmem_file_scope());
 
         return rconv;
 }
@@ -2345,7 +2345,7 @@ dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
          * plus one. If there is no previous frame then we must be at seq=1!
          * (This is per-conversation and per-direction, of course.) */
 
-        lastackseq = GPOINTER_TO_INT(se_tree_lookup32_le(rconv->seqs[cdir ^ 1], pinfo->fd->num))+1;
+        lastackseq = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->seqs[cdir ^ 1], pinfo->fd->num))+1;
 
         if (cdir==1 && lastackseq<2 && remain==17) {
                 /* Session startup: the client makes an /open/ request and
@@ -2362,12 +2362,12 @@ dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                 remain--;
         }
 
-        seq = GPOINTER_TO_INT(se_tree_lookup32(rconv->seqs[cdir], pinfo->fd->num));
+        seq = GPOINTER_TO_INT(wmem_tree_lookup32(rconv->seqs[cdir], pinfo->fd->num));
 
         if (seq==0) {
-                seq = GPOINTER_TO_INT(se_tree_lookup32_le(rconv->seqs[cdir], pinfo->fd->num));
+                seq = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->seqs[cdir], pinfo->fd->num));
                 seq += remain;
-                se_tree_insert32(rconv->seqs[cdir], pinfo->fd->num, GINT_TO_POINTER(seq));
+                wmem_tree_insert32(rconv->seqs[cdir], pinfo->fd->num, GINT_TO_POINTER(seq));
         }
 
         seq -= remain-1;
index 1b02b33ec24fb9035f50bcbd0756605ff38d5342..e6fe874c070ba42439f5a8a34d8fb387e380d968 100644 (file)
@@ -45,6 +45,7 @@
 #include <epan/packet.h>
 #include <epan/prefs.h>
 #include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/reassemble.h>
 #include <epan/asn1.h>
 #include <epan/uat.h>
@@ -811,7 +812,7 @@ static guint slr = 0;
 
 static dissector_table_t sccp_ssn_dissector_table;
 
-static emem_tree_t       *assocs        = NULL;
+static wmem_tree_t       *assocs        = NULL;
 static sccp_assoc_info_t *assoc;
 static sccp_msg_info_t   *sccp_msg;
 static sccp_assoc_info_t  no_assoc      = {0,0,0,0,0,FALSE,FALSE,NULL,NULL,SCCP_PLOAD_NONE,NULL,NULL,NULL,0};
@@ -1293,7 +1294,7 @@ looks_like_valid_sccp(guint32 frame_num _U_, tvbuff_t *tvb, guint8 my_mtp3_stand
 static sccp_assoc_info_t *
 new_assoc(guint32 calling, guint32 called)
 {
-  sccp_assoc_info_t *a = se_new0(sccp_assoc_info_t);
+  sccp_assoc_info_t *a = wmem_new0(wmem_file_scope(), sccp_assoc_info_t);
 
   a->id            = next_assoc_id++;
   a->calling_dpc   = calling;
@@ -1335,16 +1336,16 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
   case SCCP_MSG_TYPE_CR:
   {
     /* CR contains the opc,dpc,dlr key of backward messages swapped as dpc,opc,slr  */
-    emem_tree_key_t bw_key[] = {
+    wmem_tree_key_t bw_key[] = {
       {1, &dpck},
       {1, &opck},
       {1, &src_lr},
       {0, NULL}
     };
 
-    if (! ( assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, bw_key) ) && ! PINFO_FD_VISITED(pinfo) ) {
+    if (! ( assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, bw_key) ) && ! PINFO_FD_VISITED(pinfo) ) {
       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;
     }
 
@@ -1354,18 +1355,18 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
   }
   case SCCP_MSG_TYPE_CC:
   {
-    emem_tree_key_t fw_key[] = {
+    wmem_tree_key_t fw_key[] = {
       {1, &dpck}, {1, &opck}, {1, &src_lr}, {0, NULL}
     };
-    emem_tree_key_t bw_key[] = {
+    wmem_tree_key_t bw_key[] = {
       {1, &opck}, {1, &dpck}, {1, &dst_lr}, {0, NULL}
     };
 
-    if ( ( assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, bw_key) ) ) {
+    if ( ( assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, bw_key) ) ) {
       goto got_assoc;
     }
 
-    if ( (assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, fw_key) ) ) {
+    if ( (assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, fw_key) ) ) {
       goto got_assoc;
     }
 
@@ -1376,12 +1377,12 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
     pinfo->p2p_dir = P2P_DIR_RECV;
 
     if ( ! PINFO_FD_VISITED(pinfo) && ! 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_VISITED(pinfo) && ! 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;
     }
 
@@ -1389,17 +1390,17 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
   }
   case SCCP_MSG_TYPE_RLC:
   {
-    emem_tree_key_t bw_key[] = {
+    wmem_tree_key_t bw_key[] = {
       {1, &dpck}, {1, &opck}, {1, &src_lr}, {0, NULL}
     };
-    emem_tree_key_t fw_key[] = {
+    wmem_tree_key_t fw_key[] = {
       {1, &opck}, {1, &dpck}, {1, &dst_lr}, {0, NULL}
     };
-    if ( ( assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, bw_key) ) ) {
+    if ( ( assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, bw_key) ) ) {
       goto got_assoc_rlc;
     }
 
-    if ( (assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, fw_key) ) ) {
+    if ( (assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, fw_key) ) ) {
       goto got_assoc_rlc;
     }
 
@@ -1410,23 +1411,23 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
     pinfo->p2p_dir = P2P_DIR_SENT;
 
     if ( ! PINFO_FD_VISITED(pinfo) && ! 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_VISITED(pinfo) && ! 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;
     }
     break;
   }
   default:
   {
-    emem_tree_key_t key[] = {
+    wmem_tree_key_t key[] = {
       {1, &opck}, {1, &dpck}, {1, &dst_lr}, {0, NULL}
     };
 
-    assoc = (sccp_assoc_info_t *)se_tree_lookup32_array(assocs, key);
+    assoc = (sccp_assoc_info_t *)wmem_tree_lookup32_array(assocs, key);
 
     if (assoc) {
       if (assoc->calling_dpc == dpck) {
@@ -1442,7 +1443,7 @@ get_sccp_assoc(packet_info *pinfo, guint offset, guint32 src_lr, guint32 dst_lr,
 
   if (assoc && trace_sccp) {
     if ( ! PINFO_FD_VISITED(pinfo)) {
-      sccp_msg_info_t *msg = se_new0(sccp_msg_info_t);
+      sccp_msg_info_t *msg = wmem_new0(wmem_file_scope(), sccp_msg_info_t);
       msg->framenum = framenum;
       msg->offset = offset;
       msg->data.co.next = NULL;
@@ -1549,7 +1550,7 @@ dissect_sccp_gt_address_information(tvbuff_t *tvb, packet_info *pinfo,
   proto_tree *digits_tree;
   char *gt_digits;
 
-  gt_digits = (char *)ep_alloc0(GT_MAX_SIGNALS+1);
+  gt_digits = (char *)wmem_alloc0(wmem_packet_scope(), GT_MAX_SIGNALS+1);
 
   while (offset < length) {
     odd_signal = tvb_get_guint8(tvb, offset) & GT_ODD_SIGNAL_MASK;
@@ -1570,7 +1571,7 @@ dissect_sccp_gt_address_information(tvbuff_t *tvb, packet_info *pinfo,
   if (is_connectionless(message_type) && sccp_msg) {
     guint8 **gt_ptr = called ? &(sccp_msg->data.ud.called_gt) : &(sccp_msg->data.ud.calling_gt);
 
-    *gt_ptr  = (guint8 *)ep_strdup(gt_digits);
+    *gt_ptr  = (guint8 *)wmem_strdup(wmem_packet_scope(), gt_digits);
   }
 
   digits_item = proto_tree_add_string(tree, called ? hf_sccp_called_gt_digits
@@ -2613,7 +2614,7 @@ dissect_sccp_optional_parameters(tvbuff_t *tvb, packet_info *pinfo,
 static sccp_msg_info_t *
 new_ud_msg(packet_info *pinfo, guint32 msg_type _U_)
 {
-  sccp_msg_info_t *m = ep_new0(sccp_msg_info_t);
+  sccp_msg_info_t *m = wmem_new0(wmem_packet_scope(), sccp_msg_info_t);
   m->framenum = PINFO_FD_NUM(pinfo);
   m->data.ud.calling_gt = NULL;
   m->data.ud.called_gt = NULL;
@@ -4046,7 +4047,7 @@ proto_register_sccp(void)
 
   register_init_routine(&init_sccp);
 
-  assocs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "sccp_associations");
+  assocs = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
 
   sccp_tap = register_tap("sccp");