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

Hi,

Iam trying for custom dissector bit wise operation octet by octet.

I have used

   proto_tree_add_bits_item(my_sub_tree, hf_my_type, my_tvb, offset,6, TRUE);

This is 6 bit lenth.

           ..00 0010 = Message Type : FWD_CNTRL (0x02)

I can able to get the bits properly. No issues on that. i want remove

                          "..00 0010= " this PART and diplay only
                          Message Type : FWD_CNTRL (0x02)

I have tried another method using MASK

             proto_tree_add_item(my_sub_tree, hf_my_type, my_tvb, offset,6, ENC_LITTLE_ENDIAN);

             { &hf_msg_typ,
             { "Message Type ", "msg_type",FT_UINT8, BASE_HEX, VALS(msg_type_vals), 0x3f, NULL, HFILL }
             },

This one also output as

                           ..00 0010 = Message Type : FWD_CNTRL (0x02)

How can i remove

                           "..00 0010= " this PART and diplay only
                            Message Type : FWD_CNTRL (0x02)

Please Help

asked 31 May '14, 00:40

umar's gravatar image

umar
26222427
accept rate: 0%

edited 06 Jun '14, 02:59

IMHO removing ..00 0010 = Message Type : FWD_CNTRL (0x02) is a bad choice the former let you see exactly which bits are beeing dissected and the meaning of the bits. If the bits allways occure in the same Place using proto_add_item with a bit mask may be a better choice than proto_tree_add_bits_item(). Just my 2 cents.

(06 Jun '14, 04:38) Anders ♦

Have you looked at the proto_tree_add_xxx_format() or proto_tree_add_xxx_format_value() functions? They give you full control of the tree representation.

permanent link

answered 06 Jun '14, 03:54

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Hi I have tried

                  proto_tree_add_xxx_format() or proto_tree_add_xxx_format_value()  both.

                  Rteurning error. How exactly i should use to remove 
                                        "..00 0010= " this PART and diplay only
                                        Message Type : FWD_CNTRL (0x02)

Thanks in advance!

(03 Jul '14, 02:13) umar
1

Just use proto_tree_add_text() then as that gives you full control of the tree representation, but note that the field won't be filterable.

(04 Jul '14, 03:55) grahamb ♦
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:

×63
×30
×13
×8
×3

question asked: 31 May '14, 00:40

question was seen: 2,494 times

last updated: 04 Jul '14, 03:56

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