11.11.  Adding information to the dissection tree

11.11.1. TreeItem

TreeItems represent information in the packet-details pane. A root TreeItem is passed to dissectors as the third argument.

11.11.1.1. treeitem:add_packet_field()

Adds an child item to a given item, returning the child. tree_item:add_packet_field([proto_field], [tvbrange], [encoding], ...)

11.11.1.2. treeitem:add(protofield, [tvbrange], [value], [label])

Adds a child item to this tree item, returning the new child TreeItem. if the protofield represents a numeric value (int, uint or float), then it's treated as a Big Endian (network order) value. This function has a complicated form: 'treeitem:add(protofield, [tvbrange,] [[value], label]])', such that if the second argument is a tvbrange, and a third argument is given, it's a value; but if the second argument is a non-tvbrange type, then it is the value (as opposed to filling that argument with 'nil', which is invalid for this function).

11.11.1.2.1. Arguments
protofield

The ProtoField field or Proto protocol object to add to the tree.

tvbrange (optional)

The TvbRange of bytes in the packet this tree item covers/represents.

value (optional)

The field's value, instead of the ProtoField/Proto one.

label (optional)

One or more strings to use for the tree item label, instead of the ProtoField/Proto one.

11.11.1.2.2. Returns

The new child TreeItem

11.11.1.3. treeitem:add_le(protofield, [tvbrange], [value], [label])

Adds a child item to this tree item, returning the new child TreeItem. if the protofield represents a numeric value (int, uint or float), then it's treated as a Little Endian value. This function has a complicated form: 'treeitem:add_le(protofield, [tvbrange,] [[value], label]])', such that if the second argument is a tvbrange, and a third argument is given, it's a value; but if the second argument is a non-tvbrange type, then it is the value (as opposed to filling that argument with 'nil', which is invalid for this function).

11.11.1.3.1. Arguments
protofield

The ProtoField field or Proto protocol object to add to the tree.

tvbrange (optional)

The TvbRange of bytes in the packet this tree item covers/represents.

value (optional)

The field's value, instead of the ProtoField/Proto one.

label (optional)

One or more strings to use for the tree item label, instead of the ProtoField/Proto one.

11.11.1.3.2. Returns

The new child TreeItem

11.11.1.4. treeitem:set_text(text)

Sets the text of the label

11.11.1.4.1. Arguments
text

The text to be used.

11.11.1.5. treeitem:append_text(text)

Appends text to the label

11.11.1.5.1. Arguments
text

The text to be appended.

11.11.1.6. treeitem:set_expert_flags([group], [severity])

Sets the expert flags of the item.

11.11.1.6.1. Arguments
group (optional)

One of PI_CHECKSUM, PI_SEQUENCE, PI_RESPONSE_CODE, PI_REQUEST_CODE, PI_UNDECODED, PI_REASSEMBLE, PI_MALFORMED or PI_DEBUG

severity (optional)

One of PI_CHAT, PI_NOTE, PI_WARN, PI_ERROR

11.11.1.7. treeitem:add_expert_info([group], [severity], [text])

Sets the expert flags of the item and adds expert info to the packet.

11.11.1.7.1. Arguments
group (optional)

One of PI_CHECKSUM, PI_SEQUENCE, PI_RESPONSE_CODE, PI_REQUEST_CODE, PI_UNDECODED, PI_REASSEMBLE, PI_MALFORMED or PI_DEBUG

severity (optional)

One of PI_CHAT, PI_NOTE, PI_WARN, PI_ERROR

text (optional)

The text for the expert info

11.11.1.8. treeitem:set_generated()

Marks the TreeItem as a generated field (with data infered but not contained in the packet).

11.11.1.9. treeitem:set_hidden()

Should not be used

11.11.1.10. treeitem:set_len(len)

Set TreeItem's length inside tvb, after it has already been created.

11.11.1.10.1. Arguments
len

The length to be used.