Wireshark-users: Re: [Wireshark-users] saving "decode as" settings

From: Andy Howell <AndyHowell@xxxxxxxxxxxxxxxxx>
Date: Wed, 14 Feb 2007 16:33:33 -0600
Douglas Pratley wrote:
Hi Andy

Thanks. Took a look at the wishlist. Closest thing was saving preference. I had a quick look through the Lua bindings, but did see a way to set a dissector for a particular port.


Sorry, but did you mean "didn't" here? I can't see an exact example
myself; I think there used to be one, but perhaps it has been moved.

Sorry, "didn't" is what I meant.

Anyway, if you can get Lua working, the following snippet will set the
"user decode" for a udp port:

	my dissector = Dissectors.get("<my_dissector_name>")
	udp_table = DissectorTable.get("udp.port")
	udp_table:add(<port_number>, my_dissector)

Replace <my_dissector_name> with the name of the dissector you want to
use, and <port_number> with the number of the port.

This only works for dissectors that have been registered by name.
Normally a dissector is registered under the lower case name of its
associated protocol, e.g. the HTTP dissector is "http".

Ah, thats simple enough. Thanks. I didn't compile in Lua support. Didn't know what it was until now :) I'll rebuild with it and give it a try.

I still think this would be a useful feature, so I'm glad you've posted
to the dev list as well.

I haven't looked at the Wireshark code, but it seems like most of the pieces should be there, that its just a bit of glue code to add the saving feature.

Regards,

	Andy