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-ilp.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-ilp.c')
-rw-r--r-- | epan/dissectors/packet-ilp.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/epan/dissectors/packet-ilp.c b/epan/dissectors/packet-ilp.c index 5a80683719..7d4eb2febc 100644 --- a/epan/dissectors/packet-ilp.c +++ b/epan/dissectors/packet-ilp.c @@ -4081,10 +4081,13 @@ dissect_ilp_ILP_PDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pro /*--- PDUs ---*/ -static void dissect_ILP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int dissect_ILP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { + int offset = 0; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo); - dissect_ilp_ILP_PDU(tvb, 0, &asn1_ctx, tree, hf_ilp_ILP_PDU_PDU); + offset = dissect_ilp_ILP_PDU(tvb, offset, &asn1_ctx, tree, hf_ilp_ILP_PDU_PDU); + offset += 7; offset >>= 3; + return offset; } @@ -4099,11 +4102,12 @@ get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return tvb_get_ntohs(tvb,offset); } -static void -dissect_ilp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ilp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, ilp_desegment, ILP_HEADER_SIZE, - get_ilp_pdu_len, dissect_ILP_PDU_PDU); + get_ilp_pdu_len, dissect_ILP_PDU_PDU, data); + return tvb_length(tvb); } void proto_reg_handoff_ilp(void); @@ -5639,7 +5643,7 @@ void proto_register_ilp(void) { NULL, HFILL }}, /*--- End of included file: packet-ilp-hfarr.c ---*/ -#line 98 "../../asn1/ilp/packet-ilp-template.c" +#line 99 "../../asn1/ilp/packet-ilp-template.c" }; /* List of subtrees */ @@ -5785,7 +5789,7 @@ void proto_register_ilp(void) { &ett_ilp_T_tia801Payload, /*--- End of included file: packet-ilp-ettarr.c ---*/ -#line 104 "../../asn1/ilp/packet-ilp-template.c" +#line 105 "../../asn1/ilp/packet-ilp-template.c" }; module_t *ilp_module; @@ -5793,7 +5797,7 @@ void proto_register_ilp(void) { /* Register protocol */ proto_ilp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("ilp", dissect_ilp_tcp, proto_ilp); + new_register_dissector("ilp", dissect_ilp_tcp, proto_ilp); /* Register fields and subtrees */ proto_register_field_array(proto_ilp, hf, array_length(hf)); |