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-openwire.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-openwire.c')
-rw-r--r-- | epan/dissectors/packet-openwire.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c index 92c04bad67..6caa22d742 100644 --- a/epan/dissectors/packet-openwire.c +++ b/epan/dissectors/packet-openwire.c @@ -1309,8 +1309,8 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in return (offset - startOffset); } -static void -dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint offset = 0; @@ -1343,7 +1343,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN); expert_add_info(pinfo, openwireroot_tree, &ei_openwire_tight_encoding_not_supported); - return; + return tvb_length(tvb); } caching = retrieve_caching(pinfo); @@ -1359,6 +1359,8 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command fields unknown to Wireshark: %d", iCommand); } } + + return tvb_length(tvb); } static guint @@ -1371,15 +1373,16 @@ get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return 0; } -static void -dissect_openwire_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_openwire_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - tcp_dissect_pdus(tvb, pinfo, tree, openwire_desegment, 5, get_openwire_pdu_len, dissect_openwire); + tcp_dissect_pdus(tvb, pinfo, tree, openwire_desegment, 5, get_openwire_pdu_len, dissect_openwire, data); + return tvb_length(tvb); } static gboolean -dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { conversation_t *conversation; gboolean detected = FALSE; @@ -1421,7 +1424,7 @@ dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void conversation_set_dissector(conversation, openwire_tcp_handle); /* Dissect the packet */ - dissect_openwire(tvb, pinfo, tree); + dissect_openwire(tvb, pinfo, tree, data); return TRUE; } return FALSE; @@ -2014,6 +2017,6 @@ void proto_reg_handoff_openwire(void) { heur_dissector_add("tcp", dissect_openwire_heur, proto_openwire); - openwire_tcp_handle = create_dissector_handle(dissect_openwire_tcp, proto_openwire); + openwire_tcp_handle = new_create_dissector_handle(dissect_openwire_tcp, proto_openwire); dissector_add_handle("tcp.port", openwire_tcp_handle); } |