aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rlc.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-23 02:20:13 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-23 02:20:13 +0000
commit9b7fb8a81120f99babc82e25416f9e25fe616c73 (patch)
tree5dc37cedfddb9588b91957f7da7aeaac83d75543 /epan/dissectors/packet-rlc.c
parentb3a24c5cc401498535ffdb64aaa212e46e587698 (diff)
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
Diffstat (limited to 'epan/dissectors/packet-rlc.c')
-rw-r--r--epan/dissectors/packet-rlc.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c
index 122e1744a6..6244908d23 100644
--- a/epan/dissectors/packet-rlc.c
+++ b/epan/dissectors/packet-rlc.c
@@ -356,8 +356,8 @@ rlc_channel_assign(struct rlc_channel *ch, enum rlc_mode mode, packet_info *pinf
fp_info *fpinf;
atm = &pinfo->pseudo_header->atm;
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!fpinf || !rlcinf) return -1;
if (rlcinf->urnti[fpinf->cur_tb]) {
@@ -1324,11 +1324,11 @@ rlc_call_subdissector(enum rlc_channel_type channel, tvbuff_t *tvb,
if (msgtype != RRC_MESSAGE_TYPE_INVALID) {
struct rrc_info *rrcinf;
fp_info *fpinf;
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rrcinf = (rrc_info *)p_get_proto_data(pinfo->fd, proto_rrc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rrcinf = (rrc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rrc, 0);
if (!rrcinf) {
rrcinf = (rrc_info *)wmem_alloc0(wmem_file_scope(), sizeof(struct rrc_info));
- p_add_proto_data(pinfo->fd, proto_rrc, 0, rrcinf);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rrc, 0, rrcinf);
}
rrcinf->msgtype[fpinf->cur_tb] = msgtype;
call_dissector(rrc_handle, tvb, pinfo, tree);
@@ -1590,8 +1590,8 @@ dissect_rlc_tm(enum rlc_channel_type channel, tvbuff_t *tvb, packet_info *pinfo,
fp_info *fpinf;
rlc_info *rlcinf;
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (tree) {
if (fpinf && rlcinf) {
@@ -1827,8 +1827,8 @@ dissect_rlc_um(enum rlc_channel_type channel, tvbuff_t *tvb, packet_info *pinfo,
next_byte = tvb_get_guint8(tvb, offs++);
seq = next_byte >> 1;
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (tree) {
if (fpinf && rlcinf) {
@@ -2221,8 +2221,8 @@ dissect_rlc_am(enum rlc_channel_type channel, tvbuff_t *tvb, packet_info *pinfo,
proto_item *truncated_ti, *ti;
guint64 polling;
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
next_byte = tvb_get_guint8(tvb, offs++);
dc = next_byte >> 7;
@@ -2353,7 +2353,7 @@ dissect_rlc_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
if (!fpi) return; /* dissection failure */
if (tree) {
@@ -2374,7 +2374,7 @@ dissect_rlc_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
if (!fpi) return; /* dissection failure */
if (tree) {
@@ -2404,7 +2404,7 @@ dissect_rlc_ctch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
if (!fpi) return; /* dissection failure */
if (tree) {
@@ -2429,8 +2429,8 @@ dissect_rlc_dcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlci = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!fpi || !rlci){
ti = proto_tree_add_text(tree, tvb, 0, -1,
@@ -2469,8 +2469,8 @@ dissect_rlc_ps_dtch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlci = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!fpi || !rlci) {
ti = proto_tree_add_text(tree, tvb, 0, -1,
@@ -2511,8 +2511,8 @@ dissect_rlc_dch_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC");
col_clear(pinfo->cinfo, COL_INFO);
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlci = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (!fpi || !rlci) return;
@@ -2581,14 +2581,14 @@ dissect_rlc_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset += (gint)strlen(RLC_START_STRING);
/* If redissecting, use previous info struct (if available) */
- fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
+ fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
if (fpi == NULL) {
/* Allocate new info struct for this frame */
fpi = (fp_info *)wmem_alloc0(wmem_file_scope(), sizeof(fp_info));
} else {
fpInfoAlreadySet = TRUE;
}
- rlci = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
if (rlci == NULL) {
/* Allocate new info struct for this frame */
rlci = (rlc_info *)wmem_alloc0(wmem_file_scope(), sizeof(rlc_info));
@@ -2649,10 +2649,10 @@ dissect_rlc_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Store info in packet if needed */
if (!fpInfoAlreadySet) {
- p_add_proto_data(pinfo->fd, proto_fp, 0, fpi);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_fp, 0, fpi);
}
if (!rlcInfoAlreadySet) {
- p_add_proto_data(pinfo->fd, proto_rlc, 0, rlci);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlci);
}
/**************************************/
@@ -2717,8 +2717,8 @@ rlc_is_ciphered(packet_info * pinfo){
return global_rlc_ciphered;
}
- fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0);
- rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0);
+ fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0);
return ((rlcinf && fpinf && (rlcinf->ciphered[fpinf->cur_tb] == TRUE) && (rlcinf->deciphered[fpinf->cur_tb] == FALSE))
|| global_rlc_ciphered);