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

Hello,

I was given a lua dissector and I need to call this dissector from another dissector that I wrote in C. Is there anyway that I can accomplish this. My dissector currently calls another C dissector without issue using the find_dissector(string) function. When I do this with the lua script, it just return null. I know that the all dissectors work on their own.

Thank you.

asked 23 Jun '15, 14:16

TheSuperShoe's gravatar image

TheSuperShoe
6112
accept rate: 0%


I found a "fix" to my issue.

I had to check in my dissect function if the handle was null, then call find_dissector() again. The other C dissectors I use are fine being called from my proto_reg_handoff_() function.

My guess is that the lua dissectors are not registered at the same time as the C dissectors, therefor the C dissector could not find the lua until it was dissecting.

permanent link

answered 24 Jun '15, 13:28

TheSuperShoe's gravatar image

TheSuperShoe
6112
accept rate: 0%

Yes, something has to be done "first", and it's the C-code dissectors. Really the Lua scripts don't even get loaded until all the C-code based initialization is done.

If you can change the Lua script, you could have the Lua-based dissector register itself to be invoked by the C-code based one. In other words, instead of making the C-code find the Lua-based dissector to invoke it, reverse it and have the C-code based one create a dissector table (register_dissector_table()), so the Lua script can register itself in that table (using DissectorTable.get("myCCodeDissector") in Lua).

(24 Jun '15, 14:50) Hadriel
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×637
×431

question asked: 23 Jun '15, 14:16

question was seen: 1,358 times

last updated: 24 Jun '15, 14:50

p​o​w​e​r​e​d by O​S​Q​A