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-bitcoin.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-bitcoin.c')
-rw-r--r-- | epan/dissectors/packet-bitcoin.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c index 337503459d..55ae1af59d 100644 --- a/epan/dissectors/packet-bitcoin.c +++ b/epan/dissectors/packet-bitcoin.c @@ -1043,7 +1043,7 @@ static msg_dissector_t msg_dissectors[] = {"alert", dissect_bitcoin_msg_empty} }; -static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { proto_item *ti; guint32 i; @@ -1074,7 +1074,7 @@ static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre tvb_sub = tvb_new_subset_remaining(tvb, offset); msg_dissectors[i].function(tvb_sub, pinfo, tree); - return; + return tvb_length(tvb); } } @@ -1082,14 +1082,15 @@ static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "[unknown command]"); expert_add_info(pinfo, ti, &ei_bitcoin_command_unknown); + return tvb_length(tvb); } static int -dissect_bitcoin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_bitcoin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { col_clear(pinfo->cinfo, COL_INFO); tcp_dissect_pdus(tvb, pinfo, tree, bitcoin_desegment, BITCOIN_HEADER_LENGTH, - get_bitcoin_pdu_length, dissect_bitcoin_tcp_pdu); + get_bitcoin_pdu_length, dissect_bitcoin_tcp_pdu, data); return tvb_reported_length(tvb); } |