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

There is a field in my protocol that I would like to display as base.DEC_HEX, except when it is a reserved value, in which case I would like to display a string (with a dec or hex value in parentheses).

I do NOT want the values to show as Unknown (value), which is what happens when I create a string table with just the reserved value and reference it in the ProtoField.new call.

What is the best way to accomplish this? I know I can use an if statement and assign a label when calling tree:add() but this seems less than ideal, and would be a pain if I had several reserved values instead of just one.

asked 10 Feb '15, 10:00

chojiao's gravatar image

chojiao
11225
accept rate: 0%


Extract the value and decide what code path to follow to represent it in the tree. That's how you can divide the complexity into existing functions. Yes there's some duplication of data points, unfortunately.

permanent link

answered 11 Feb '15, 06:04

Jaap's gravatar image

Jaap ♦
11.7k16101
accept rate: 14%

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:

×29
×12
×7
×1

question asked: 10 Feb '15, 10:00

question was seen: 1,281 times

last updated: 11 Feb '15, 06:04

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