I have defined a foo protocol dissector in Wireshark and compiled it successfully, but when I try adding this dissector in Preferences->Protocols->DLT_USER->Encapsulations Table, it shows this error:
Please advise. EDIT: SOURCE ADDED BELOW
asked 04 Feb ‘12, 07:33 ashish_goel edited 06 Feb ‘12, 22:41 helloworld |
2 Answers:
You need to register your dissector with name, register_dissector("rtp", dissect_rtp, proto_rtp); answered 04 Feb '12, 08:33 Anders ♦ showing 5 of 16 show 11 more comments |
I've seen this when the answered 06 Feb '12, 13:30 multipleinte... thanks, it worked.. I had to create a new workspace and it worked. I guess some file was corrupted (07 Feb '12, 22:38) ashish_goel |
Hi I added the following statement in the function proto_register_foo() function but no use.. Still getting the same error :(
There is no "following statement" in your comment. Presumably you didn't literally add the statement
as that would only work for an RTP dissector, but you instead registered with a name such as "foo" and with names such as
dissect_foo
andproto_foo
as arguments.You also need to put it in your dissector's "register" routine (not the "register_handoff" routine).
@ guy harris. I added : register_dissector("foo",dissect_foo,proto_foo); function call at the last line of proto_register_foo() routine. I guess I have done it right as per your suggestion. but its not working.
I.e., if you open up the preferences for DLT_USER, click the "Edit..." button for "Encapsulations Table", click "New" or select an existing item and click "Edit...", and put "foo" into the "Payload protocol" field, and click "OK", you get that error?
@guy harris. yes, I followed the same steps. And the foo protocol which I have defined is the same one which is there is developer's guide.
It might help if you edited your question to include your code for
proto_register_foo()
.not having that right now.. will edit it in few hours.. BTW Is there anything not clear?
No. Adding
register_dissector
(ornew_register_dissector
) is supposed to work (and I've confirmed it does for me using the code template from README.developer with the latest source). Maybe there's something in your code that you don't see.And to be complete, my
proto_register_foo()
looks like this:I have called register_dissector() function not new_register_dissector().
BTW I have edited the ques to include the source of my proto_register_foo function.
any suggestions plz??
You can use either
new_register_dissector
orregister_dissector
, but the latter requires a type-cast ondissect_foo
(depending on which source list you added your dissector to).Your code works for me (I can add "foo" to the DLT table from prefs). If you type
foo
into Wireshark's Display Filter textbox, the textbox's background should turn green. Otherwise, your dissector isn't even registered. Is your source actually being compiled?My source file is located in:
I added
packet-foo.c
to theDISSECTOR_SRC
list in:If you're not using CMake (i.e., you're using the
autotools
build), the file to modify is:the dissector is registered for sure. I can use it in the decode as option. Even the filter text box turns green.
the new_register_dissector function not working for me. throws an error while compiling.
I don't have any other suggestions other than for you to step through the code with a debugger (put a breakpoint at
uat_fld_chk_proto
).thanks, for all the help. I had to create a new workspace and it worked. I guess some file was corrupted