aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-netsync.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-netsync.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-netsync.c')
-rw-r--r--epan/dissectors/packet-netsync.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c
index f03ac4b44f..5a25745185 100644
--- a/epan/dissectors/packet-netsync.c
+++ b/epan/dissectors/packet-netsync.c
@@ -430,8 +430,8 @@ get_netsync_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 1 + 1 + size_bytes + (guint)size + 4;
}
-static void
-dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
guint8 tmp;
@@ -442,9 +442,8 @@ dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Set the protocol column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netsync");
-
if (tree == NULL)
- return;
+ return tvb_length(tvb);
while (tvb_reported_length_remaining(tvb, offset) > 0) {
ti = proto_tree_add_item(tree, proto_netsync, tvb, offset, -1, ENC_NA);
@@ -549,13 +548,16 @@ dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_len(netsync_tree, 1+1+size_bytes+size+4);
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_netsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, netsync_desegment, 7, get_netsync_pdu_len,
- dissect_netsync_pdu);
+ dissect_netsync_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -751,7 +753,7 @@ proto_reg_handoff_netsync(void)
static gboolean initialized = FALSE;
if (!initialized) {
- netsync_handle = create_dissector_handle(dissect_netsync, proto_netsync);
+ netsync_handle = new_create_dissector_handle(dissect_netsync, proto_netsync);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", tcp_port_netsync, netsync_handle);