aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-iec104.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
commit8081cf1d90397cbbb4404f9720595e1537ed5e14 (patch)
tree353220f46e08be1f0020603538f501b65bea8f3b /epan/dissectors/packet-iec104.c
parentc9b2ee3768abb730b49fc4fc779e77578a1c4971 (diff)
Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that? Should tcp_dissect_pdus return length (bytes consumed)? There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb). Seems like that could all be rolled into one. svn path=/trunk/; revision=53198
Diffstat (limited to 'epan/dissectors/packet-iec104.c')
-rw-r--r--epan/dissectors/packet-iec104.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c
index 454e7f1c83..f9e17705f8 100644
--- a/epan/dissectors/packet-iec104.c
+++ b/epan/dissectors/packet-iec104.c
@@ -1348,7 +1348,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* Is is called twice: For 'Packet List' and for 'Packet Details' */
-static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint TcpLen = tvb_reported_length(tvb);
guint8 Start, len, type, temp8;
@@ -1383,7 +1383,7 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (len < APDU_MIN_LEN) {
expert_add_info_format(pinfo, ti, &ei_iec104_apdu_min_len, "APDU less than %d bytes", APDU_MIN_LEN);
wmem_strbuf_append_printf(res, "<ERR ApduLen=%u bytes> ", len);
- return;
+ return tvb_length(tvb);
}
temp8 = tvb_get_guint8(tvb, Off + 2);
@@ -1439,18 +1439,19 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (Start != APCI_START) {
/* Everything is bad (no APCI found) */
proto_tree_add_item(it104tree, hf_apcidata, tvb, 0, Off, ENC_NA);
- return;
}
+ return tvb_length(tvb);
}
-static void dissect_iec104reas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_iec104reas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* 5th parameter = 6 = minimum bytes received to calculate the length.
* (Not 2 in order to find more APCIs in case of 'noisy' bytes between the APCIs)
*/
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, APCI_LEN,
- get_iec104apdu_len, dissect_iec104apci);
+ get_iec104apdu_len, dissect_iec104apci, data);
+ return tvb_length(tvb);
}
/* The protocol has two subprotocols: Register APCI */
@@ -1798,7 +1799,7 @@ proto_reg_handoff_iec104(void)
{
dissector_handle_t iec104apci_handle;
- iec104apci_handle = create_dissector_handle(dissect_iec104reas, proto_iec104apci);
+ iec104apci_handle = new_create_dissector_handle(dissect_iec104reas, proto_iec104apci);
iec104asdu_handle = create_dissector_handle(dissect_iec104asdu, proto_iec104asdu);
dissector_add_uint("tcp.port", IEC104_PORT, iec104apci_handle);