aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
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 /asn1
parentc248e3c5b2d64f25bbec6973b5eea42a55a87bc7 (diff)
Convert atn-* dissectors to wmem. No emem in new code please!
svn path=/trunk/; revision=51780
Diffstat (limited to 'asn1')
-rw-r--r--asn1/atn-cm/packet-atn-cm-template.c1
-rw-r--r--asn1/atn-cpdlc/packet-atn-cpdlc-template.c3
-rw-r--r--asn1/atn-ulcs/atn-ulcs.cnf18
-rw-r--r--asn1/atn-ulcs/packet-atn-ulcs-template.c46
-rw-r--r--asn1/atn-ulcs/packet-atn-ulcs-template.h11
5 files changed, 35 insertions, 44 deletions
diff --git a/asn1/atn-cm/packet-atn-cm-template.c b/asn1/atn-cm/packet-atn-cm-template.c
index 779d742e2e..4571aa92f2 100644
--- a/asn1/atn-cm/packet-atn-cm-template.c
+++ b/asn1/atn-cm/packet-atn-cm-template.c
@@ -50,7 +50,6 @@
#include <epan/conversation.h>
#include <epan/dissectors/packet-ber.h>
#include <epan/dissectors/packet-per.h>
-#include <epan/emem.h>
#include <epan/conversation.h>
#include <stdio.h>
diff --git a/asn1/atn-cpdlc/packet-atn-cpdlc-template.c b/asn1/atn-cpdlc/packet-atn-cpdlc-template.c
index de4e917dff..2f9b0ab11d 100644
--- a/asn1/atn-cpdlc/packet-atn-cpdlc-template.c
+++ b/asn1/atn-cpdlc/packet-atn-cpdlc-template.c
@@ -54,7 +54,6 @@
#include <epan/conversation.h>
#include <epan/dissectors/packet-ber.h>
#include <epan/dissectors/packet-per.h>
-#include <epan/emem.h>
#include <stdio.h>
#include <string.h>
@@ -359,4 +358,4 @@ void proto_reg_handoff_atn_cpdlc(void)
*
* vi: set shiftwidth=2 tabstop=2 noexpandtab:
* :indentSize=2:tabSize=2:noTabs=false:
- */ \ No newline at end of file
+ */
diff --git a/asn1/atn-ulcs/atn-ulcs.cnf b/asn1/atn-ulcs/atn-ulcs.cnf
index 00cc6a5ef4..a4ece639fe 100644
--- a/asn1/atn-ulcs/atn-ulcs.cnf
+++ b/asn1/atn-ulcs/atn-ulcs.cnf
@@ -219,8 +219,7 @@ PDV-list/presentation-data-values/arbitrary pdv-list_presentation-data-values_ar
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,
@@ -235,8 +234,7 @@ PDV-list/presentation-data-values/arbitrary pdv-list_presentation-data-values_ar
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,
@@ -268,18 +266,18 @@ PDV-list/presentation-data-values/arbitrary pdv-list_presentation-data-values_ar
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 */
@@ -302,7 +300,7 @@ PDV-list/presentation-data-values/arbitrary pdv-list_presentation-data-values_ar
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 */
@@ -314,9 +312,9 @@ PDV-list/presentation-data-values/arbitrary pdv-list_presentation-data-values_ar
/* 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);
diff --git a/asn1/atn-ulcs/packet-atn-ulcs-template.c b/asn1/atn-ulcs/packet-atn-ulcs-template.c
index 17a219f3e0..9ce3d6bcbd 100644
--- a/asn1/atn-ulcs/packet-atn-ulcs-template.c
+++ b/asn1/atn-ulcs/packet-atn-ulcs-template.c
@@ -121,7 +121,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>
@@ -144,8 +144,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;
@@ -454,7 +454,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; }
@@ -462,7 +462,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 */
@@ -475,7 +475,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 */
@@ -487,13 +487,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;
}
@@ -520,8 +520,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;
}
@@ -546,16 +546,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);
@@ -854,7 +854,7 @@ void proto_register_atn_ulcs (void)
NULL,
HFILL}},
};
-
+
static gint *ett[] = {
#include "packet-atn-ulcs-ettarr.c"
&ett_atn_ses,
@@ -862,12 +862,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,
@@ -884,22 +884,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)
diff --git a/asn1/atn-ulcs/packet-atn-ulcs-template.h b/asn1/atn-ulcs/packet-atn-ulcs-template.h
index 88a6a82cb6..7b09f8d283 100644
--- a/asn1/atn-ulcs/packet-atn-ulcs-template.h
+++ b/asn1/atn-ulcs/packet-atn-ulcs-template.h
@@ -33,6 +33,8 @@
#include "packet.h"
+#include <epan/wmem/wmem.h>
+
/* IA5 charset (7-bit) for PER IA5 decoding */
static const gchar ia5alpha[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \
@@ -45,7 +47,7 @@ static const gchar ia5alpha[] = {
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, \
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, '\0'
};
-
+
enum msg_type {
um,
dm,
@@ -78,7 +80,7 @@ atn_conversation_t * find_atn_conversation(
address*,
guint16,
address*);
-
+
/* struct for conversation data reconstruction used in AARQ and AARE */
/* if transport data is larger than 32 octets AARQ/AARE is contained */
/* within DT frames which have only dest_ref, but no src_ref */
@@ -91,8 +93,8 @@ typedef struct aarq_data_t {
/* i.e. GND facility initialises cpcstart and cmcontact at the same time */
atn_conversation_t* cv; /* pointer to AARQ conversation */
} aarq_data_t;
-
-emem_tree_t *get_atn_conversation_tree(void);
+
+wmem_tree_t *get_atn_conversation_tree(void);
guint32 get_aircraft_24_bit_address_from_nsap(packet_info *);
int check_heur_msg_type(packet_info *);
@@ -111,4 +113,3 @@ int check_heur_msg_type(packet_info *);
* vi: set shiftwidth=2 tabstop=2 noexpandtab:
* :indentSize=2:tabSize=2:noTabs=false:
*/
-