The dissector that I'm working on includes a header that encodes a DAG. The easiest way to read a DAG in human-readable format is in a way where each node (maximum of 9 nodes) is converted to a string and placed on a different line. I am looking to implement in Wireshark something like:
Where the indentation denotes that the three nodes above are in the subtree of "Destination DAG." Some things I have tried:
The closest that I have come to seeing another dissector that might be able to do this is the TCP options fields. There doesn't appear to be a field name anywhere (no colon), but the content looks static, which is not the case with my dissector.
Is there a way to do this? Thanks in advance for any help! asked 12 Jun '12, 09:05 Cody edited 12 Jun '12, 09:11 |
One Answer:
The problem here is that you can't have a header field without a name and an appended colon before the content. Yes you can. Have a look at the answered 12 Jun '12, 09:35 cmaynard ♦♦ |
Works perfectly, thank you. I got tripped up when the compiler complained about that function when it had only one argument, but I've worked out a solution.
Well,
proto_tree_add_string_format()
takes a minimum of 7 arguments, so by "only one argument" you presumably mean "only the format string argument".If so, then note that the ONLY valid format argument for any printf-like function is a format string. If you want to print an arbitrary string, the way to do that is by having
"%s"
as the format string and having the arbitrary string be the argument to the format string, e.g.not
Yes, I misspoke about the arguments, thank you. And I also tried what you suggest above with the following code:
And the call that is not commented out returns the error:
packet-xip.c:86:4: error: format not a string literal and no format arguments [-Werror=format-security]
Anything that I’m obviously missing here?
The “value” argument to
proto_tree_add_string_format()
. “add_string” means “add a string value to the protocol tree”, and “format” means “but display it with the format and format arguments after the string value argument”. Try