OSQA is unmaintained. Help us figure out where to go from here.

Hello wireshark gurus, I have a simple problem(but quite devastating for me). I am trying to update this dissector from wireshark 1.6 to 2.2 for windows. I have successfully removed all the errors due to change in API, except for one --> proto_tree_add_text. I know it should be replaced by proto_tree_add_xxx. But I couldn't find any way of understanding how to implement the change.I have read the readme files. but I'm unable to attain any success after trying a lot. New functions require some parameter named 'id' eg. proto_tree_add_string(tree, id, tvb, start, length, value_ptr); What is this ID? Could anyone please guide me solving this issue. I'm posting some of the code snippets. Thanks

proto_item *header_item = proto_tree_add_text(cidsifecmd_tree, tvb, CIDSIFE_HEADER_FIRST_BYTE_START, CIDSIFE_HEADER_LENGTH,
        "Header > Protocol Revision: %u, Airframe Manufacturer: %u, Data Length: %u",
        ife_protocol_revision, ife_airframe_manufactor, ife_data_length

proto_tree_add_text(command_tree, tvb,  7, 1, "Direct PA:\t\t%s", try_val_to_str(getbits(tvb_get_guint8(tvb, 7), 1, 2), discrete_status_var));

proto_tree_add_text(command_tree, tvb, 7, 1, "Video In Use:\t%s",
                try_val_to_str(getbits(tvb_get_guint8(tvb, 7), 3, 2), discrete_status_var)
        proto_tree_add_text(command_tree, tvb, 5, 10, "Item\tVPA\tNMPA\tAudioType");
        for (row = 0; row < 10; row++) {
            proto_tree_add_text(command_tree, tvb, 5, 10, "VPA%u\t%s\t%s\t%s",
                    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], vpa_audio_type_var)


It also appears once in the header file

#define PROTO_TREE_ADD_HEADER( ife_tree, ife_command, element_start, element_length )                       \
        proto_item *sub_item = proto_tree_add_text(      \
                (ife_tree) , tvb, (element_start),      \
                ife_numberOfElements * (element_length),  \
                "%s (%u entries)",   \
                try_val_to_str( (ife_command) , command_name_var),  \
                ife_numberOfElements        \
        );       \
   proto_tree *sub_tree = proto_item_add_subtree(sub_item, ett_cidsifecmd_tree)

asked 02 Dec '16, 09:20

xaheen's gravatar image

accept rate: 50%

edited 02 Dec '16, 10:05

grahamb's gravatar image

grahamb ♦

The is a Perl helper script in tools\convert_proto_tree_add_text.pl that does a fair bit of the donkey work for you, but may need manual assistance to complete the conversion.

The script might not work correctly on your macro in the header file, but after you see what the script has done to the other functions you should be able to work out what is needed in the macro. I suspect the macro may need additional parameter(s).

permanent link

answered 02 Dec '16, 10:15

grahamb's gravatar image

grahamb ♦
accept rate: 22%

Thanks a lot @grahamb Sadly now I am lost with this convert_proto_tree_add_text.pl file :p trying to figure out what to do with it as I have no Idea about Perl.

(05 Dec '16, 13:58) xaheen
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](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:


question asked: 02 Dec '16, 09:20

question was seen: 763 times

last updated: 05 Dec '16, 13:58

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