Ethereal-dev: Re: [Ethereal-dev] BACnet (dissector_add: assertion failed)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Hartmut Mueller <hartmut@xxxxxxxxxxxxxxxxx>
Date: Sun, 18 Feb 2001 14:42:34 +0100
On Saturday, 17. February 2001 23:52, Guy Harris wrote:

Thanks a lot! Assertion runs with your modifications. It would be easier for 
newbies to put this in the documentation READMEs.

> The BVLC dissector would have to register, in its "proto_register"
> routine, a dissector table, by doing:
>
>   static dissector_table_t bvlc_dissector_table;

>   void
>   proto_register_bvlc(void)
>   {
> 	...
>
>           proto_bvlc = proto_register_protocol("BACnet Virtual Link
> Control", "BVLC", "bvlc");
>           proto_register_field_array(proto_bvlc, hf, array_length(hf));
>           proto_register_subtree_array(ett, array_length(ett));
>           register_dissector("bvlc", dissect_bvlc, proto_bvlc);
>
>           /* subdissector code */
>   	  bvlc_dissector_table = register_dissector_table("bvlc.function");
>   }

> you'd do
>
> 	next_tvb = tvb_new_subset(tvb,offset+4,-1,npdu_length);
> 	if (!dissector_try_port(bvlc_dissector_table, function, next_tvb,
> 	    pinfo, tree) {
> 		/* Unknown function - dissect the paylod as data */
> 		dissect_data(next_tvb, 0, pinfo, tree);
> 	}
>
> where "function" would be a variable set to the value of the "function"
> field in the BVLC packet.