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

I have been trying to update a plugin(from 1.6 to 2.2). In the previous plugin, the following code was used to create a table data.

for (row = 0; row < 10; row++) {
                proto_tree_add_text(command_tree, tvb, FIRSTELEMENT_START + 2*row, ELEMENT_LENGTH,    "PA%u\t%s\t%s\t%s %s %u",
                        row + 1,
                        try_val_to_str(pa_array[row][0], discrete_status_var),
                        try_val_to_str(pa_array[row][1], discrete_status_var),
                        try_val_to_str(pa_array[row][2], source_deck_var),
                        try_val_to_str(pa_array[row][3], source_type_var),
                        pa_array[row][4]
                );
            }

I have been trying to replace the proto_tree_add_text by proto_tree_add_item to achieve the same result, but without any success. Can someone please help me? Thanks a lot.

asked 23 Feb, 07:10

xaheen's gravatar image

xaheen
71141519
accept rate: 50%

edited 23 Feb, 08:10

grahamb's gravatar image

grahamb ♦
19.8k330205


You can use proto_tree_add_XXX_format() functions but combining several values on the same line defeats the possibility to filter individual items, so it is not encouraged.

permanent link

answered 24 Feb, 01:59

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k960
accept rate: 30%

1

What they could do is create a top-level item with multiple values and then put each of the individual values as named fields underneath that top-level item.

(24 Feb, 13:46) Guy Harris ♦♦

Could you please tell me where I can find some example use of proto_tree_add_XXX_format()? Thanks @Pascal Quantin @Guy Harris

(27 Feb, 02:07) xaheen

Proto_tree_add_string_format works perfectly! :D

(09 Mar, 00:41) xaheen
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:

×10
×7
×5
×3

question asked: 23 Feb, 07:10

question was seen: 454 times

last updated: 09 Mar, 00:41

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