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-winsrepl.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-winsrepl.c')
-rw-r--r-- | epan/dissectors/packet-winsrepl.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/epan/dissectors/packet-winsrepl.c b/epan/dissectors/packet-winsrepl.c index c1337b7f5d..dd0dc82e91 100644 --- a/epan/dissectors/packet-winsrepl.c +++ b/epan/dissectors/packet-winsrepl.c @@ -631,21 +631,19 @@ dissect_winsrepl_replication(tvbuff_t *winsrepl_tvb, packet_info *pinfo, return winsrepl_offset; } -static void -dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { int offset = 0; - proto_item *winsrepl_item = NULL; - proto_tree *winsrepl_tree = NULL; + proto_item *winsrepl_item; + proto_tree *winsrepl_tree; enum wrepl_mess_type mess_type; col_set_str(pinfo->cinfo, COL_PROTOCOL, "WINS-Replication"); col_clear(pinfo->cinfo, COL_INFO); - if (parent_tree) { - winsrepl_item = proto_tree_add_item(parent_tree, proto_winsrepl, tvb, offset, -1, ENC_NA); - winsrepl_tree = proto_item_add_subtree(winsrepl_item, ett_winsrepl); - } + winsrepl_item = proto_tree_add_item(parent_tree, proto_winsrepl, tvb, offset, -1, ENC_NA); + winsrepl_tree = proto_item_add_subtree(winsrepl_item, ett_winsrepl); /* SIZE */ proto_tree_add_item(winsrepl_tree, hf_winsrepl_size, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -689,7 +687,7 @@ dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; } - return; + return tvb_length(tvb); } static guint @@ -701,10 +699,11 @@ get_winsrepl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return pdu_len+4; } -static void -dissect_winsrepl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_winsrepl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - tcp_dissect_pdus(tvb, pinfo, parent_tree, winsrepl_reassemble, 4, get_winsrepl_pdu_len, dissect_winsrepl_pdu); + tcp_dissect_pdus(tvb, pinfo, parent_tree, winsrepl_reassemble, 4, get_winsrepl_pdu_len, dissect_winsrepl_pdu, data); + return tvb_length(tvb); } void @@ -886,6 +885,6 @@ proto_reg_handoff_winsrepl(void) { dissector_handle_t winsrepl_handle; - winsrepl_handle = create_dissector_handle(dissect_winsrepl, proto_winsrepl); + winsrepl_handle = new_create_dissector_handle(dissect_winsrepl, proto_winsrepl); dissector_add_uint("tcp.port", glb_winsrepl_tcp_port, winsrepl_handle); } |