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-wow.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-wow.c')
-rw-r--r-- | epan/dissectors/packet-wow.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c index e21e81cba4..daeb225ec9 100644 --- a/epan/dissectors/packet-wow.c +++ b/epan/dissectors/packet-wow.c @@ -138,37 +138,6 @@ static gboolean wow_preference_desegment = TRUE; static gint ett_wow = -1; static gint ett_wow_realms = -1; -static void dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -static guint get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset); - - -static gboolean -dissect_wow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) -{ - gint8 size_field_offset = -1; - guint8 cmd; - - cmd = tvb_get_guint8(tvb, 0); - - if(WOW_SERVER_TO_CLIENT && cmd == REALM_LIST) - size_field_offset = 1; - if(WOW_CLIENT_TO_SERVER && cmd == AUTH_LOGON_CHALLENGE) - size_field_offset = 2; - - if(size_field_offset > -1) { - tcp_dissect_pdus(tvb, pinfo, tree, wow_preference_desegment, - size_field_offset+2, get_wow_pdu_len, - dissect_wow_pdu); - - } else { - /* Doesn't have a size field, so it cannot span multiple - segments. Therefore, dissect this packet normally. */ - dissect_wow_pdu(tvb, pinfo, tree); - } - - return TRUE; -} - static guint get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) { @@ -189,8 +158,8 @@ get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) } -static void -dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *wow_tree, *wow_realms_tree; @@ -427,6 +396,35 @@ dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + + return tvb_length(tvb); +} + +static gboolean +dissect_wow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) +{ + gint8 size_field_offset = -1; + guint8 cmd; + + cmd = tvb_get_guint8(tvb, 0); + + if(WOW_SERVER_TO_CLIENT && cmd == REALM_LIST) + size_field_offset = 1; + if(WOW_CLIENT_TO_SERVER && cmd == AUTH_LOGON_CHALLENGE) + size_field_offset = 2; + + if(size_field_offset > -1) { + tcp_dissect_pdus(tvb, pinfo, tree, wow_preference_desegment, + size_field_offset+2, get_wow_pdu_len, + dissect_wow_pdu, data); + + } else { + /* Doesn't have a size field, so it cannot span multiple + segments. Therefore, dissect this packet normally. */ + dissect_wow_pdu(tvb, pinfo, tree, data); + } + + return TRUE; } |