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-ymsg.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-ymsg.c')
-rw-r--r-- | epan/dissectors/packet-ymsg.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c index 3ea845b194..fbc071bc58 100644 --- a/epan/dissectors/packet-ymsg.c +++ b/epan/dissectors/packet-ymsg.c @@ -324,9 +324,6 @@ static const value_string ymsg_status_vals[] = { {0, NULL} }; -static guint get_ymsg_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset); -static void dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - /* Find the end of the current content line and return its length */ static int get_content_item_length(tvbuff_t *tvb, int offset) { @@ -342,23 +339,6 @@ static int get_content_item_length(tvbuff_t *tvb, int offset) return offset - origoffset; } - -static gboolean -dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) -{ - if (tvb_length(tvb) < 4) { - return FALSE; - } - if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) { - /* Not a Yahoo Messenger packet. */ - return FALSE; - } - - tcp_dissect_pdus(tvb, pinfo, tree, ymsg_desegment, 10, get_ymsg_pdu_len, - dissect_ymsg_pdu); - return TRUE; -} - static guint get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { @@ -375,8 +355,8 @@ get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return plen + YAHOO_HEADER_SIZE; } -static void -dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ymsg_tree, *ti; proto_item *content_item; @@ -488,7 +468,24 @@ dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_fence(pinfo->cinfo, COL_INFO); - return; + return tvb_length(tvb); +} + + +static gboolean +dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) +{ + if (tvb_length(tvb) < 4) { + return FALSE; + } + if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) { + /* Not a Yahoo Messenger packet. */ + return FALSE; + } + + tcp_dissect_pdus(tvb, pinfo, tree, ymsg_desegment, 10, get_ymsg_pdu_len, + dissect_ymsg_pdu, data); + return TRUE; } void |