This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Get dissector table from another plugin

0

Hello,
I am currently developing an dissector for an USB over network protocol.
Mostly it is different from raw USB packets, but some parts are the same,
so I want to dissect them with the already existing USB dissectors (e.g. "usbms").
I want to call them by
dissector_try_uint(...)
but I cannot register the
register_dissector_table("usb.bulk","USB bulk endpoint", FT_UINT8, BASE_DEC)
again because it is already done by the USB dissector itself.
So do you have any solution? Is there maybe a way to get the already registered dissector table from the USB plugin?

Thanks for your help.

Forgot something (maybe it is important):
My dissector is not named "usb", it is named "usbsrv". I just have to register "usb.bulk" because the needed dissectors are registered to this field.

asked 14 Oct '14, 02:09

lal12's gravatar image

lal12
367712
accept rate: 33%

edited 14 Oct '14, 02:31


One Answer:

2

You can retrieve the dissector table thanks to a find_dissector_table("usb.bulk") function call.

answered 14 Oct '14, 04:17

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%

Ok now there is another Problem:
While Pascal Quantins solution seems to work, the subdissector does not start no matter whether I use the dissector_try_uint(...) or the call_dissector(...) function. There is just a new "Data" item after the tree of my dissector.
Maybe I missed something, is there a good example of calling a subdissector?
Or could the problem be reasoned by the USBMS dissector?

(14 Oct '14, 09:35) lal12

As seen in the dissect_usb_ms_bulk() function, the dissector expects that the data parameter will contain a usb_conv_info_t structure (like what is done in epan/dissectors/packet-usb.c). If this is not the case, the packet will be rejected. You should look at what is done in packet-usb.c for creating the conversation info (get_usb_conv_info() function and its callers).

(14 Oct '14, 13:00) Pascal Quantin