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-tali.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-tali.c')
-rw-r--r-- | epan/dissectors/packet-tali.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c index a18b2971b3..0eb02eba6a 100644 --- a/epan/dissectors/packet-tali.c +++ b/epan/dissectors/packet-tali.c @@ -97,8 +97,8 @@ get_tali_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return length+TALI_HEADER_LENGTH; } -static void -dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { char opcode[TALI_OPCODE_LENGTH+1]; /* TALI opcode */ guint16 length; /* TALI length */ @@ -133,13 +133,16 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, payload_tvb, pinfo, tree); } } + + return tvb_length(tvb); } -static void -dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, tali_desegment, TALI_HEADER_LENGTH, - get_tali_pdu_len, dissect_tali_pdu); + get_tali_pdu_len, dissect_tali_pdu, data); + return tvb_length(tvb); } /* @@ -150,7 +153,7 @@ dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * it is a 'well-known' operation */ static gboolean -dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { char opcode[TALI_OPCODE_LENGTH]; /* TALI opcode */ @@ -173,7 +176,7 @@ dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat strncmp(opcode, TALI_SAAL, TALI_OPCODE_LENGTH) != 0) return FALSE; - dissect_tali(tvb, pinfo, tree); + dissect_tali(tvb, pinfo, tree, data); return TRUE; } @@ -203,7 +206,7 @@ proto_register_tali(void) proto_tali = proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali"); hfi_tali = proto_registrar_get_nth(proto_tali); - register_dissector("tali", dissect_tali, proto_tali); + new_register_dissector("tali", dissect_tali, proto_tali); /* Required function calls to register the header fields and subtrees used */ proto_register_fields(proto_tali, hfi, array_length(hfi)); |