diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-09 17:46:28 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-09 17:46:28 +0000 |
commit | 8081cf1d90397cbbb4404f9720595e1537ed5e14 (patch) | |
tree | 353220f46e08be1f0020603538f501b65bea8f3b /epan/dissectors/packet-ifcp.c | |
parent | c9b2ee3768abb730b49fc4fc779e77578a1c4971 (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-ifcp.c')
-rw-r--r-- | epan/dissectors/packet-ifcp.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c index da1dda0d13..74fba22ef3 100644 --- a/epan/dissectors/packet-ifcp.c +++ b/epan/dissectors/packet-ifcp.c @@ -307,8 +307,8 @@ dissect_commonflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) } } -static void -dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { gint offset = 0, frame_len = 0; guint8 sof = 0, eof = 0; @@ -324,7 +324,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* verify we have a full header (do we need to do this? */ if(tvb_length(tvb)<iFCP_ENCAP_HEADER_LEN){ - return; + return 0; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "iFCP"); @@ -492,7 +492,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) call_dissector(data_handle, next_tvb, pinfo, parent_tree); } - return; + return tvb_length(tvb); } static guint @@ -508,10 +508,11 @@ get_ifcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return pdu_len; } -static void -dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - tcp_dissect_pdus(tvb, pinfo, parent_tree, ifcp_desegment, iFCP_MIN_HEADER_LEN, get_ifcp_pdu_len, dissect_ifcp_pdu); + tcp_dissect_pdus(tvb, pinfo, parent_tree, ifcp_desegment, iFCP_MIN_HEADER_LEN, get_ifcp_pdu_len, dissect_ifcp_pdu, data); + return tvb_length(tvb); } @@ -520,20 +521,20 @@ dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) * In this case we will not check the port number for sanity and just * do as the user said. */ -static void -dissect_ifcp_handle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ifcp_handle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - dissect_ifcp(tvb, pinfo, tree); + return dissect_ifcp(tvb, pinfo, tree, data); } static gboolean -dissect_ifcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_ifcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { if(!ifcp_header_test(tvb, 0)){ return FALSE; } - dissect_ifcp(tvb, pinfo, tree); + dissect_ifcp(tvb, pinfo, tree, data); /* our heuristics are so strong that if the heuristics above passed * and the dissection of the pdu did not cause any exceptions @@ -660,7 +661,7 @@ proto_reg_handoff_ifcp (void) { heur_dissector_add("tcp", dissect_ifcp_heur, proto_ifcp); - ifcp_handle = create_dissector_handle(dissect_ifcp_handle, proto_ifcp); + ifcp_handle = new_create_dissector_handle(dissect_ifcp_handle, proto_ifcp); dissector_add_handle("tcp.port", ifcp_handle); data_handle = find_dissector("data"); |