I have 2 plugins with just such a situation as yours where one plugin passes off dissection to the other plugin. I use find_dissector()/call_dissector().
So … in your proto_reg_handoff_foo2_proto() function, replace the dissector_add() call with “foo_handle = find_dissector(“foo_proto”)”, then wherever in your foo2_proto dissector you decide that you need to pass off dissection to the foo_proto dissector, use “call_dissector(foo_handle, …)”.
I hope it helps, Chris
From:
wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On
Behalf Of Sebastien Dubois
Thanks for the quick answer, In this case, is there any example code available that exists implementing a sub-dissector like the one I'm trying to code below, so that I can look at it to see what I'm doing wrong? Thx,
------------------------------------------------------------------------------------------------
Hi, I'm currently having problems trying to implement a new plugin as a sub-dissector to another plugin. The first plugin (let's call it foo_proto) registers itself and adds itself as a dissector that uses a given udp port as follows: -------------------------------------------------------
* proto_register_subtree_array*(ett, array_length(ett)); *void**
proto_reg_handoff_foo_proto*(*void*) The second plugin (let's call it foo2_proto) also registers itself and adds itself as a dissector that uses a registered field in the previous dissector foo_proto as follows: -------------------------------------------------------
* proto_register_subtree_array*(ett, array_length(ett)); *void**
proto_reg_handoff_foo2_proto*(*void*)
Initialized = TRUE; This compiles fine, but I get the following assertion failure in function dissector_add(...) at startup: Err file packet.c: line 671: assertion failed: (sub_dissectors) It seems that the first plugin (foo) is not registered when the second one (foo2) calls dissector_add on it. So, how does this work? How can you add a plugin dissector to another plugin dissector? Is it at all possible? Wireshark will call all register functions (it knows of) before calling any of the handoff functions. So this sequence should not be your problem. The line 671 of the assert might get a hint, but it's a bit worthless together with your code snippet .... Regards, ULFL ----------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. |
- References:
- Re: [Wireshark-dev] Plugin dissector registration order problem
- From: Sebastien Dubois
- Re: [Wireshark-dev] Plugin dissector registration order problem
- Prev by Date: Re: [Wireshark-dev] tshark: drop features "dump to stdout" and "read filter"
- Next by Date: [Wireshark-dev] Build error for asn1/x721 - help needed
- Previous by thread: Re: [Wireshark-dev] Plugin dissector registration order problem
- Next by thread: Re: [Wireshark-dev] Plugin dissector registration order problem
- Index(es):