aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dvbci.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-23 23:10:08 -0400
committerPascal Quantin <pascal.quantin@gmail.com>2016-06-29 18:53:46 +0000
commitbe12a252dd0bfeddc4b82da4690bcd582aa94d4a (patch)
tree3c15ef50b693d971ef35105a798dbd6540743aad /epan/dissectors/packet-dvbci.c
parent46561910f4372ac9fc591bb225298bee7e2879b8 (diff)
Provide new interface for Export PDU.
Rather than have a bitmask for each desired field, have a dissector provide a list of structures that represent data that goes into the PDU. Change-Id: I125190cbaee489ebffb7d9f5d8bc6f3be2d06353 Reviewed-on: https://code.wireshark.org/review/16122 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dvbci.c')
-rw-r--r--epan/dissectors/packet-dvbci.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/epan/dissectors/packet-dvbci.c b/epan/dissectors/packet-dvbci.c
index ead0db06e2..e64bd2c55c 100644
--- a/epan/dissectors/packet-dvbci.c
+++ b/epan/dissectors/packet-dvbci.c
@@ -1671,8 +1671,7 @@ dvbci_set_addrs(guint8 event, packet_info *pinfo)
return 1;
}
-
-guint8
+static guint8
dvbci_get_evt_from_addrs(packet_info *pinfo)
{
/* this should be working from C89 on */
@@ -3344,6 +3343,23 @@ dissect_dvbci_payload_cup(guint32 tag, gint len_field _U_,
}
}
+static int exp_pdu_data_dvbci_size(packet_info *pinfo _U_, void* data _U_)
+{
+ return EXP_PDU_TAG_DVBCI_EVT_LEN + 4;
+}
+
+static int exp_pdu_data_dvbci_populate_data(packet_info *pinfo, void* data, guint8 *tlv_buffer, guint32 buffer_size _U_)
+{
+ tlv_buffer[0] = 0;
+ tlv_buffer[1] = EXP_PDU_TAG_DVBCI_EVT;
+ tlv_buffer[2] = 0;
+ tlv_buffer[3] = EXP_PDU_TAG_DVBCI_EVT_LEN;
+ tlv_buffer[4] = dvbci_get_evt_from_addrs(pinfo);
+
+ return exp_pdu_data_dvbci_size(pinfo, data);
+}
+
+static exp_pdu_data_item_t exp_pdu_dvbci = {exp_pdu_data_dvbci_size, exp_pdu_data_dvbci_populate_data, NULL};
static void
dissect_sac_msg(guint32 tag, tvbuff_t *tvb, gint offset,
@@ -3438,10 +3454,13 @@ dissect_sac_msg(guint32 tag, tvbuff_t *tvb, gint offset,
/* we call this function also to dissect exported SAC messages,
don't try to export them a second time */
if (!exported && is_exportable && have_tap_listener(exported_pdu_tap)) {
+ static const exp_pdu_data_item_t *dvbci_exp_pdu_items[] = {
+ &exp_pdu_dvbci,
+ NULL
+ };
tvbuff_t *clear_sac_msg_tvb;
exp_pdu_data_t *exp_pdu_data;
- guint8 tags[2];
clear_sac_msg_tvb = tvb_new_composite();
tvb_composite_append(clear_sac_msg_tvb,
@@ -3449,10 +3468,7 @@ dissect_sac_msg(guint32 tag, tvbuff_t *tvb, gint offset,
tvb_composite_append(clear_sac_msg_tvb, clear_sac_body_tvb);
tvb_composite_finalize(clear_sac_msg_tvb);
- tags[0] = 0;
- tags[1] = EXP_PDU_TAG_DVBCI_EVT_BIT;
- exp_pdu_data = load_export_pdu_tags(
- pinfo, EXP_PDU_TAG_PROTO_NAME, EXPORTED_SAC_MSG_PROTO, tags, 2);
+ exp_pdu_data = export_pdu_create_tags(pinfo, EXPORTED_SAC_MSG_PROTO, EXP_PDU_TAG_PROTO_NAME, dvbci_exp_pdu_items);
exp_pdu_data->tvb_captured_length = tvb_captured_length(clear_sac_msg_tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(clear_sac_msg_tvb);