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

I am new to wireshark and I am trying to upgrade a plugin that was build for 1.x to 2.x. One of those steps is replacing proto_tree_add_text() with proto_tree_add_item()

if the old code is

proto_tree_add_text(foo_tree, tvb, 0, -1, "header ver. %s", header_array[index]);

I know I would have to start with

static hf_register_info hf[] = {
    { &foo_header,
        { "header ver. ", "foo.header",
        NULL, 0x0,
        NULL, HFILL }
proto_tree_add_item(foo_tree, foo_header, tvb, 0, -1, ENC_NA);

But how would I add the array into the string to display? Where is a good source to learn about using hf_register_info?

asked 21 Jul '17, 15:19

allantse's gravatar image

accept rate: 100%

proto_tree_add_none_format(foo_tree, foo_header, tvb, 0, -1, "header ver. %s", header_array[index]);
permanent link

answered 21 Jul '17, 21:53

Guy%20Harris's gravatar image

Guy Harris ♦♦
accept rate: 19%

thank you!

(04 Aug '17, 09:32) allantse

From the little information you have given I would consider rewriting the code and add the header information elements with proto_tree_add_item() with Hf_header_version and the appropriate length of the field.

(04 Aug '17, 09:46) Anders ♦
Your answer
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: 21 Jul '17, 15:19

question was seen: 953 times

last updated: 04 Aug '17, 09:46

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