From 9b7fb8a81120f99babc82e25416f9e25fe616c73 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 23 Nov 2013 02:20:13 +0000 Subject: Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470) I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future. And search/replace of a function name is easy enough to do. The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As. All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope(). All other dissectors were converted to using file_scope() which was the original scope for "proto" data. svn path=/trunk/; revision=53520 --- epan/dissectors/packet-k12.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'epan/dissectors/packet-k12.c') diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 3801420897..7818e43fd4 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -276,10 +276,10 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) for (i = 0; handles[i] && handles[i+1]; ++i) { if (handles[i] == sscop_handle) { - sscop_payload_info *p_sscop_info = (sscop_payload_info *)p_get_proto_data(pinfo->fd, proto_sscop, 0); + sscop_payload_info *p_sscop_info = (sscop_payload_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_sscop, 0); if (!p_sscop_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_add_proto_data(wmem_file_scope(), pinfo, proto_sscop, 0, p_sscop_info); p_sscop_info->subdissector = handles[i+1]; } } @@ -290,10 +290,10 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) /* Setup information required by certain protocols */ if (sub_handle == fp_handle) { - fp_info *p_fp_info = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0); + fp_info *p_fp_info = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); if (!p_fp_info) { p_fp_info = wmem_new0(wmem_file_scope(), fp_info); - p_add_proto_data(pinfo->fd, proto_fp, 0, p_fp_info); + p_add_proto_data(wmem_file_scope(), pinfo, proto_fp, 0, p_fp_info); fill_fp_info(p_fp_info, pinfo->pseudo_header->k12.extra_info, -- cgit v1.2.3