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

I'm writing a dissector that must be capable of extracting numeric values from a TvbRange that spans multiple bytes, while only considering certain bits. I'm a bit concerned about chossing the right method that will also ensure the correct endianess and signedness.

From my understanding I could add a bitmask when creating the ProtoField. However this fails with "bad argument #4 to 'uint16' (must be a table)". ProtoField.uint16("abc","abc",base.DEC, 0x3000, nil, "") Any idea what is causing this? Does Wireshark apply the mask on the raw data and then start coverting to uint16?

Secondly, I would also like to have the value in an local variable. If I for instance call buf(1,2):bitfield(2,2), it will return a number, but is there some way of ensuring the correct endianess and signing? Can I maybe retrieve the values from the TreeItem?

Thanks

asked 14 Jun '16, 11:44

Luanda's gravatar image

Luanda
6112
accept rate: 0%

Be the first one to answer this question!
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:

×431
×8
×3
×2

question asked: 14 Jun '16, 11:44

question was seen: 2,319 times

last updated: 14 Jun '16, 11:44

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