Wireshark-dev: Re: [Wireshark-dev] Adding multiple ports for dissector
Date: Wed, 29 Oct 2008 15:18:17 -0700
Thanks Steve.

I have implemented the changes and it works as expected.

--Sunny

On Oct 29, 2008 2:49pm, Stephen Fisher <stephentfisher@xxxxxxxxx> wrote:
> On Wed, Oct 29, 2008 at 01:38:24PM -0700, jdolly@xxxxxxxxx wrote:
>
>
>
>
>
> > I have a packet dissector implemented on a single TCP Port (user
>
>
> > enterable through Preferences).
>
>
> >
>
>
> > I would like to add multiple ports to this dissector.
>
>
> >
>
>
> > Looks like I have to use "prefs_register_range_preference" function in
>
>
> > my protocol registration routine.
>
>
>
>
>
> Yup.
>
>
>
>
>
> > What are the other changes that need to be made to my packet dissector
>
>
> > file?
>
>
>
>
>
> Take a look at epan/dissectors/packet-xml.c for an example.
>
>
> packet-http.c also has it, but it looks a bit more complicated.
>
>
>
>
>
> Basically, you're registering a range that is stored in a string, then
>
>
> you copy it with range_copy() and do a range_foreach() call to operate
>
>
> on the copy of the list of ports and have it call (in xml's case)
>
>
> range_add_xml_tcp_callback() for each port in the range list.
>
>
> range_add_xml_tcp_callback() is a one line function that does a
>
>
> dissector_add() on each tcp port it is handed.
>
>
>
>
>
>
>
>
> Steve
>
>
>
>
>
> _______________________________________________
>
>
> Wireshark-dev mailing list
>
>
> Wireshark-dev@xxxxxxxxxxxxx
>
>
> https://wireshark.org/mailman/listinfo/wireshark-dev
>
>
>