Wireshark-dev: Re: [Wireshark-dev] what parameters for dissector_add() for a non-nested protoco
wireshark-dev-bounces@xxxxxxxxxxxxx wrote on 07/16/2007 06:12:02 PM:
... snip ...
> You could, for example,
... snip ...
> acn_dissector_table = register_dissector_table("acn.proto", "ACN
> protocol number", FT_UINT32, BASE_HEX);
>
> have the dissector for your private WTAP type do
>
> if (!dissector_try_port(acn_dissector_table,
> pinfo->pseudo_header->acn.proto, tvb, pinfo, tree))
> call dissect_data to dissect the data, or something such as that
>
> and have the "ipars" dissector do
>
> dissector_add("acn.proto", 0x5, ipars_handle);
Well thats what (I think) I'm now doing, and yet, the value
isn't registered, because the 'default' dissector gets called,
not my ipars dissector.
Obviously I'm not getting something right. And thats got to do
with the function and relationship between proto_register_xxx()
and proto_reg_handoff_xxx() and what the job of each is, and what
I should be doing in each. :-(
So I'm concerned about a race condition regarding when
proto_register_sita() is called (that tries to add the
ipars handle to the table), with respectto when the
proto_reg_handoff_ipars() is called (creating the ipars
dissector in the first place).
I also tried putting the:
dissector_add("sita.proto", ACN_PROTO_IPARS, ipars_handle);
in proto_register_handoff_ipars(),
but that caused a run-time error about:
(dissector add): assertion failed (sub_dissectors)
--------- packet-sita.c ----------
disect_sita() {
...
if (!dissector_try_port(sita_dissector_table,
pinfo->pseudo_header->sita.proto, tvb, pinfo, tree)) {
call_dissector(data_handle, tvb, pinfo, tree); /* default decoder
*/
}
}
proto_register_sita() {
proto_sita = proto_register_protocol("SITA", "sita", "sita");
sita_dissector_table = register_disector_table("sita.proto",
"ACN protocol number", FT_UINT8, BASE_HEX);
register_dissector("sita", dissect_sita, proto_sita);
dissector_add("sita.proto", ACN_PROTO_IPARS, ipars_handle);
}
proto_reg_handoff_sita() {
ipars_handle = find_dissector("ipars");
sita_handle = create_dissector(dissect_sita, proto_sita);
dissector_add("wtap_encap", WTAP_ENCAP_SITA, sita_handle);
}
--------- packet_ipars.c ---------
proto_register_handoff_ipars() {
register_dissector("ipars", dissect_ipars, proto_ipars);
}
This document is strictly confidential and intended only for use by the addressee unless otherwise stated. If you are not the intended recipient, please notify the sender immediately and delete it from your system.