Ethereal-dev: Re: [Ethereal-dev] How to use dissector_add

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

Date Prev · Date Next · Thread Prev · Thread Next
From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 31 Dec 2004 12:01:00 -0800
Stefano Pettini wrote:

My protocol (ALC, RFC 3450) is based on UDP, but the rfc doesn't define a default port. Indeed, the protocol seems to use a set of consecutive UDP ports, starting from a base one, which is not specified and is left to the user discretion.

...so one possibility would be to make it a preference setting, as per one of Luis Ontanon's suggestions. You'd have to pick a default port, though - although you could make a port number of 0 mean "don't register it", and make that the default.

I've left proto_ref_handoff_xxx empty, but my dissector becomes invisible (I can't choose it manually in the "decode as..." window).

Maybe it's not possible to automatically decode, after a brief inspection, an unknown UDP packet as an ALC one,

That'd be a heuristic dissector (as Luis mentioned) - a very quick look at RFC 3450 doesn't suggest a good heuristic.

but do I have to call dissect_add with a fake default UDP port, even if that default isn't specified?

No - you could call "dissector_add_handle()" to add it to the list of dissectors that could be dissected based on the UDP port; it takes no port number, so it doesn't cause any particular port to be dissected with the dissector in question, but it does arrange that "Decode As" can be used with a UDP port number.