aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2019-01-28 15:04:10 +0100
committerAnders Broman <a.broman58@gmail.com>2019-01-28 15:24:54 +0000
commitd90806a9b40b77ca5d0b2ce1190bd793185734d2 (patch)
tree5d8c75f6f5b2544c086709451ccb7673711d662f /epan
parent3cd5ac36e20d56a43e002b926aec3b99488c85a1 (diff)
IEEE1609dot2: Use GUINT_TO_POINTER/GPOINTER_TO_UINT to store a guint32
This should be changed so that ieee1609dot2 is called with a struct as data containing the psid. If needed it can be stored in actx->private data. Change-Id: Iccef08a93fd090eb586401b2999684eee2afb382 Reviewed-on: https://code.wireshark.org/review/31775 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/asn1/ieee1609dot2/ieee1609dot2.cnf4
-rw-r--r--epan/dissectors/asn1/ieee1609dot2/packet-ieee1609dot2-template.c4
-rw-r--r--epan/dissectors/packet-ieee1609dot2.c18
3 files changed, 11 insertions, 15 deletions
diff --git a/epan/dissectors/asn1/ieee1609dot2/ieee1609dot2.cnf b/epan/dissectors/asn1/ieee1609dot2/ieee1609dot2.cnf
index ab7b011192..20672b0627 100644
--- a/epan/dissectors/asn1/ieee1609dot2/ieee1609dot2.cnf
+++ b/epan/dissectors/asn1/ieee1609dot2/ieee1609dot2.cnf
@@ -55,10 +55,10 @@ UnknownLongitude
if (my_private_data->unsecured_data) {
// psid may also be provided in HeaderInfo
- guint32 *psid = (guint32*)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_ieee1609dot2, 0);
+ guint32 psid = GPOINTER_TO_UINT(p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_ieee1609dot2, 0));
if (psid) {
/* Call next dissector here */
- dissector_try_uint(unsecured_data_subdissector_table, *psid, my_private_data->unsecured_data, actx->pinfo, tree);
+ dissector_try_uint(unsecured_data_subdissector_table, psid, my_private_data->unsecured_data, actx->pinfo, tree);
my_private_data->unsecured_data = NULL;
}
// else: wait for the HeaderInfo for a second chance to dissect the content
diff --git a/epan/dissectors/asn1/ieee1609dot2/packet-ieee1609dot2-template.c b/epan/dissectors/asn1/ieee1609dot2/packet-ieee1609dot2-template.c
index a139ee809f..9518c57983 100644
--- a/epan/dissectors/asn1/ieee1609dot2/packet-ieee1609dot2-template.c
+++ b/epan/dissectors/asn1/ieee1609dot2/packet-ieee1609dot2-template.c
@@ -49,9 +49,7 @@ typedef struct ieee1609_private_data {
void
ieee1609dot2_set_next_default_psid(packet_info *pinfo, guint32 psid)
{
- guint32 *ctxt = wmem_new0(wmem_file_scope(), guint32);
- *ctxt = psid;
- p_add_proto_data(wmem_file_scope(), pinfo, proto_ieee1609dot2, 0, (void*)ctxt);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_ieee1609dot2, 0, GUINT_TO_POINTER(psid));
}
#include "packet-ieee1609dot2-fn.c"
diff --git a/epan/dissectors/packet-ieee1609dot2.c b/epan/dissectors/packet-ieee1609dot2.c
index 2440c3bc59..d6cefb654a 100644
--- a/epan/dissectors/packet-ieee1609dot2.c
+++ b/epan/dissectors/packet-ieee1609dot2.c
@@ -193,7 +193,7 @@ static int hf_ieee1609dot2_EndEntityType_app = -1;
static int hf_ieee1609dot2_EndEntityType_enrol = -1;
/*--- End of included file: packet-ieee1609dot2-hf.c ---*/
-#line 37 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
+#line 36 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
/* Initialize the subtree pointers */
static int ett_ieee1609dot2_ssp = -1;
@@ -265,7 +265,7 @@ static gint ett_ieee1609dot2_SubjectPermissions = -1;
static gint ett_ieee1609dot2_VerificationKeyIndicator = -1;
/*--- End of included file: packet-ieee1609dot2-ett.c ---*/
-#line 41 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
+#line 40 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
static dissector_table_t unsecured_data_subdissector_table;
static dissector_table_t ssp_subdissector_table;
@@ -278,9 +278,7 @@ typedef struct ieee1609_private_data {
void
ieee1609dot2_set_next_default_psid(packet_info *pinfo, guint32 psid)
{
- guint32 *ctxt = wmem_new0(wmem_file_scope(), guint32);
- *ctxt = psid;
- p_add_proto_data(wmem_file_scope(), pinfo, proto_ieee1609dot2, 0, (void*)ctxt);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_ieee1609dot2, 0, GUINT_TO_POINTER(psid));
}
@@ -1328,10 +1326,10 @@ dissect_ieee1609dot2_T_unsecuredData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx
if (my_private_data->unsecured_data) {
// psid may also be provided in HeaderInfo
- guint32 *psid = (guint32*)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_ieee1609dot2, 0);
+ guint32 psid = GPOINTER_TO_UINT(p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_ieee1609dot2, 0));
if (psid) {
/* Call next dissector here */
- dissector_try_uint(unsecured_data_subdissector_table, *psid, my_private_data->unsecured_data, actx->pinfo, tree);
+ dissector_try_uint(unsecured_data_subdissector_table, psid, my_private_data->unsecured_data, actx->pinfo, tree);
my_private_data->unsecured_data = NULL;
}
// else: wait for the HeaderInfo for a second chance to dissect the content
@@ -1955,7 +1953,7 @@ static int dissect_Ieee1609Dot2Data_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U
/*--- End of included file: packet-ieee1609dot2-fn.c ---*/
-#line 59 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
+#line 56 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
/*--- proto_register_ieee1609dot2 ----------------------------------------------*/
@@ -2556,7 +2554,7 @@ void proto_register_ieee1609dot2(void) {
NULL, HFILL }},
/*--- End of included file: packet-ieee1609dot2-hfarr.c ---*/
-#line 67 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
+#line 64 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
};
/* List of subtrees */
@@ -2629,7 +2627,7 @@ void proto_register_ieee1609dot2(void) {
&ett_ieee1609dot2_VerificationKeyIndicator,
/*--- End of included file: packet-ieee1609dot2-ettarr.c ---*/
-#line 72 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
+#line 69 "./asn1/ieee1609dot2/packet-ieee1609dot2-template.c"
&ett_ieee1609dot2_ssp,
};