Provide access to raw value attribute #17
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because rtshark copies pyshark and prefers "show" over "value", useful information from tshark's output can be inaccessible. For example, I was trying to collect all the TLS records associated with a TLS handshake message. Those fields look like:
So Metadata::value for "tls.handshake.fragment" might give me "9", which is the frame number of the packet containing the fragment. I can then use that frame number to look up the packet containing the fragment and call "tcp.payload" / "tcp.reassembled.data" on it to get the fragment data. However, if I could just access "value" instead of "show", I could skip all that extra manual work.
This isn't a blocker for me. Even if the PR is accepted I might keep manually collecting the TLS records from TCP payloads instead of using the fragments, because the TCP payloads include the TLS record headers, which is kind of nice. It was just mildly annoying that I could see the data I needed in tshark, but couldn't access it from rtshark.
I'm not a huge fan of "raw_value" as a name for the new method, but "value" is already taken so it was the best I could come up with. I'm also not sure if the potential increase in the size of the Metadata is a problem. At least for my use case, "value" is significantly larger than "show", so I can definitely see that being a concern.