aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-atn-ulcs.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-09-05 12:13:00 +0000
committerEvan Huus <eapache@gmail.com>2013-09-05 12:13:00 +0000
commit3b6f55c579c23a12d609e81be0188f6448b832c4 (patch)
treecd0af4382b66bb26ec8adb7d82adbdf3578501b7 /epan/dissectors/packet-atn-ulcs.c
parentc248e3c5b2d64f25bbec6973b5eea42a55a87bc7 (diff)
Convert atn-* dissectors to wmem. No emem in new code please!
svn path=/trunk/; revision=51780
Diffstat (limited to 'epan/dissectors/packet-atn-ulcs.c')
-rw-r--r--epan/dissectors/packet-atn-ulcs.c64
1 files changed, 28 insertions, 36 deletions
diff --git a/epan/dissectors/packet-atn-ulcs.c b/epan/dissectors/packet-atn-ulcs.c
index 7aeccc95d4..602ed2ed0f 100644
--- a/epan/dissectors/packet-atn-ulcs.c
+++ b/epan/dissectors/packet-atn-ulcs.c
@@ -129,7 +129,7 @@ which ATN standard is supported ?
#include <epan/packet.h>
#include <epan/dissectors/packet-ber.h>
#include <epan/dissectors/packet-per.h>
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
#include <epan/address.h>
#include <epan/conversation.h>
@@ -152,8 +152,8 @@ static int proto_atn_ulcs = -1;
static guint32 ulcs_context_value = 0;
static const char *object_identifier_id;
-static emem_tree_t *aarq_data_tree = NULL;
-static emem_tree_t *atn_conversation_tree = NULL;
+static wmem_tree_t *aarq_data_tree = NULL;
+static wmem_tree_t *atn_conversation_tree = NULL;
static proto_tree *root_tree = NULL;
@@ -1130,8 +1130,7 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
pinfo->clnp_dstref,
&pinfo->src );
if(!atn_cv){
- atn_cv = (atn_conversation_t*)
- se_alloc(sizeof(atn_conversation_t));
+ atn_cv = wmem_new(wmem_file_scope(), atn_conversation_t);
atn_cv->ae_qualifier = unknown;
create_atn_conversation(&pinfo->dst,
pinfo->clnp_dstref,
@@ -1146,8 +1145,7 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
pinfo->clnp_srcref,
&pinfo->dst );
if(!atn_cv){
- atn_cv = (atn_conversation_t*)
- se_alloc(sizeof(atn_conversation_t));
+ atn_cv = wmem_new(wmem_file_scope(), atn_conversation_t);
atn_cv->ae_qualifier = unknown;
create_atn_conversation(&pinfo->src,
pinfo->clnp_srcref,
@@ -1181,18 +1179,18 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
get_aircraft_24_bit_address_from_nsap(pinfo);
/* search for aarq entry */
- aarq_data = (aarq_data_t *) se_tree_lookup32(
+ aarq_data = (aarq_data_t *) wmem_tree_lookup32(
aarq_data_tree,
aircraft_24_bit_address);
if(!aarq_data){ /* aarq data not found, create new record */
/* alloc aarq data */
- aarq_data = (aarq_data_t*) se_alloc(sizeof(aarq_data_t));
+ aarq_data = wmem_new(wmem_file_scope(), aarq_data_t);
aarq_data-> aarq_pending = FALSE;
/* insert aarq data */
- se_tree_insert32(aarq_data_tree ,aircraft_24_bit_address,(void*)aarq_data);
+ wmem_tree_insert32(aarq_data_tree ,aircraft_24_bit_address,(void*)aarq_data);
}
/* check for pending AARQ/AARE sequences */
@@ -1332,7 +1330,7 @@ dissect_atn_ulcs_AARE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
guint32 aircraft_24_bit_address = 0 ;
atn_conversation_t *atn_cv = NULL;
aarq_data_t *aarq_data = NULL;
-
+
/* get AARQ data and use it to create a new conversation, */
/* the conversation is used along with */
/* AARQ's "calling ae qualifier" to determine the */
@@ -1344,9 +1342,9 @@ dissect_atn_ulcs_AARE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
/* get 24-bit icao address */
aircraft_24_bit_address = get_aircraft_24_bit_address_from_nsap(pinfo);
-
+
/* search for aarq entry */
- aarq_data = (aarq_data_t *) se_tree_lookup32(
+ aarq_data = (aarq_data_t *) wmem_tree_lookup32(
aarq_data_tree,
aircraft_24_bit_address);
@@ -1846,7 +1844,7 @@ int check_heur_msg_type(packet_info *pinfo _U_)
int t = no_msg;
guint8* addr = NULL;
guint32 adr_prefix =0;
-
+
/* check NSAP address type*/
if( (pinfo->src.type != AT_OSI) || (pinfo->dst.type != AT_OSI)) {
return t; }
@@ -1854,7 +1852,7 @@ int check_heur_msg_type(packet_info *pinfo _U_)
/* check NSAP address length; 20 octets address length required */
if( (pinfo->src.len != 20) || (pinfo->dst.len != 20)) {
return t; }
-
+
addr = (guint8*) pinfo->src.data;
/* convert address to 32-bit integer */
@@ -1867,7 +1865,7 @@ int check_heur_msg_type(packet_info *pinfo _U_)
if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) {
t = dm; /* source is an aircraft: it's a downlink PDU */
}
-
+
addr = (guint8*) pinfo->dst.data;
/* convert address to 32-bit integer */
@@ -1879,13 +1877,13 @@ int check_heur_msg_type(packet_info *pinfo _U_)
/* 0xc1 ("all Mobile ATSC") for mobile stations (aka aircraft).*/
if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) {
t = um; /* destination is aircraft: uplink PDU */
- }
+ }
return t;
}
/* conversation may be used by other dissectors */
-emem_tree_t *get_atn_conversation_tree(void){
+wmem_tree_t *get_atn_conversation_tree(void){
return atn_conversation_tree;
}
@@ -1912,8 +1910,8 @@ atn_conversation_t * find_atn_conversation(
/* search for atn conversation */
cv = (atn_conversation_t *)
- se_tree_lookup32(get_atn_conversation_tree(),key);
-
+ wmem_tree_lookup32(get_atn_conversation_tree(),key);
+
return cv;
}
@@ -1938,16 +1936,16 @@ atn_conversation_t * create_atn_conversation(
/* search for aircraft entry */
cv = (atn_conversation_t *)
- se_tree_lookup32(
+ wmem_tree_lookup32(
get_atn_conversation_tree(),
key);
/* tree node already present */
if(cv) {
return NULL; }
-
+
/* insert conversation data in tree*/
- se_tree_insert32(
+ wmem_tree_insert32(
get_atn_conversation_tree(),
key,
(void*)conversation);
@@ -2539,7 +2537,7 @@ void proto_register_atn_ulcs (void)
NULL,
HFILL}},
};
-
+
static gint *ett[] = {
/*--- Included file: packet-atn-ulcs-ettarr.c ---*/
@@ -2577,12 +2575,12 @@ void proto_register_atn_ulcs (void)
&ett_atn_acse,
&ett_atn_ulcs
};
-
+
proto_atn_ulcs = proto_register_protocol (
ATN_ULCS_PROTO ,
"ATN-ULCS",
"atn-ulcs");
-
+
proto_register_field_array (
proto_atn_ulcs,
hf_atn_ulcs,
@@ -2599,22 +2597,16 @@ void proto_register_atn_ulcs (void)
atn_cm_handle = find_dissector("atn-cm");
atn_cpdlc_handle = find_dissector("atn-cpdlc");
-
+
/* initiate sub dissector list */
register_heur_dissector_list(
"atn-ulcs",
&atn_ulcs_heur_subdissector_list);
/* init aare/aare data */
- if(!aarq_data_tree) {
- aarq_data_tree = se_tree_create(
- EMEM_TREE_TYPE_RED_BLACK,
- "aarq-data"); }
-
- if(!atn_conversation_tree) {
- atn_conversation_tree = se_tree_create(
- EMEM_TREE_TYPE_RED_BLACK,
- "atn-conversations"); }
+ aarq_data_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
+
+ atn_conversation_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
}
void proto_reg_handoff_atn_ulcs(void)