For example : In this picture the type "UPDATE Message" is also included in the Border Gateway Protocol tree description an it is a field below it. asked 12 May '16, 04:01 javiguembe |
One Answer:
Your screenshot is an example of taking an important (distinctive) value from the protocol data and using it as part of the subtree title. So algorithmically, you first parse the tvb at least until you get the value of such parameter (or, if it has a fixed format, fetch it directly from a known position), and only then you compose the description for the tree item at level N, use tree:add to apply that label and hook in a subtree, and then add the subtree items, including the parameter whose value you've already used for the subtree title. But that seems so obvious to me that I'm afraid I've actually misunderstood what you've asked. answered 15 May '16, 03:31 sindy |
I have this to dissect BGP:
My problem is that I don´t know how can I add syntactically in the same subtree 2 Protofields. Concatenating with “..” return error (obviusly?).
I’ve converted your previous post from an Answer to your original Question (which it clearly wasn’t) to a Comment to my Answer. See site FAQ for details.
To the subject:
You’ve got it right: you cannot hook two distinct protocol fields (as
ProtoField
objects) as a single item to the tree.But you can describe the tree item using only a reference to a tvb range (spanning even several protocol fields), extract the values from just some (even completely unrelated to that range) bytes of the tvb as text, and use that text as a label of that treeitem, which is what most likely what the original dissector does. So unless ProtoField has recently become a mandatory parameter of
treeitem:add
, the following should work:Look here for details of the highly flexible syntax of
treeitem:add
.See also section 11.7.1.5. treeitem:append_text(text). This allows you to append more information to the tree item so you don’t necessarily have to construct it all at once.
Thanks sindy and cmaynard! Both methods works!