From 8081cf1d90397cbbb4404f9720595e1537ed5e14 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 9 Nov 2013 17:46:28 +0000 Subject: 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 --- asn1/sabp/packet-sabp-template.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'asn1/sabp') diff --git a/asn1/sabp/packet-sabp-template.c b/asn1/sabp/packet-sabp-template.c index 81bf989d45..59c09ed0d3 100644 --- a/asn1/sabp/packet-sabp-template.c +++ b/asn1/sabp/packet-sabp-template.c @@ -199,8 +199,8 @@ get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) } -static void -dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *sabp_item = NULL; proto_tree *sabp_tree = NULL; @@ -213,14 +213,16 @@ dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) sabp_tree = proto_item_add_subtree(sabp_item, ett_sabp); dissect_SABP_PDU_PDU(tvb, pinfo, sabp_tree, NULL); + return tvb_length(tvb); } /* Note a little bit of a hack assumes length max takes two bytes and that the length starts at byte 4 */ -static void -dissect_sabp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sabp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, gbl_sabp_desegment, 5, - get_sabp_pdu_len, dissect_sabp); + get_sabp_pdu_len, dissect_sabp, data); + return tvb_length(tvb); } /*--- proto_register_sbap -------------------------------------------*/ @@ -270,8 +272,8 @@ void proto_register_sabp(void) { proto_register_subtree_array(ett, array_length(ett)); /* Register dissector */ - register_dissector("sabp", dissect_sabp, proto_sabp); - register_dissector("sabp.tcp", dissect_sabp_tcp, proto_sabp); + new_register_dissector("sabp", dissect_sabp, proto_sabp); + new_register_dissector("sabp.tcp", dissect_sabp_tcp, proto_sabp); /* Register dissector tables */ sabp_ies_dissector_table = register_dissector_table("sabp.ies", "SABP-PROTOCOL-IES", FT_UINT32, BASE_DEC); -- cgit v1.2.3