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

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?


asked 14 Jun '16, 11:44

Luanda's gravatar image

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


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