Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: [Wireshark-users] LUA set value for treeitem

From: "Pawlowsky, Marc" <mpawlowsky@xxxxxxxx>
Date: Wed, 19 Sep 2018 13:45:34 +0000

Is there a way to set the value for a treeitem after the tree item has been created?

 

The problem:

 

I am writing a X.409 based decoder (similar ASN.1).

 

I have a property stored as an integer to decode.

I come up with a tree like:

 

  • Myproperty
    • X.409 Integer
      • Tag
      • Length
      • Value

 

 

The length of the value field is variable.

 

I have a protofield for all treeitems.

For my property I am currently using

pf_myproperty = ProtoField.uint8("myprop.myproperty ", "myproperty", base.HEX)

 

I create the myproperty treeitem first, then drill down and create the treeitems underneath it.

To prevent the protofield from decoding nonsense I am setting the value explicitly

  local myproperty_tree = tree:add(pf_myproperty, buffer(offset), 0)

 

After all the tree items are created I can set the length using myproperty_tree::set_len(len)

 

Is there a way I can set the value after creation?

 

I want to be able to filter on myproperty.

Something like myprop.myproperty==0xFF

 

I cannot find anything in

https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tree.html

 

 

Thanks

  Marc