Wireshark-dev: Re: [Wireshark-dev] field reg
How about using val_to_str() in combination with an appropriate proto_tree_add_xyz_format() function? Something like:
static const value_string msg_vals[] = { {42, "Name of Message (42)"}, {0, NULL} };
msgval = tvb_get_xyz(tvb, offset); proto_tree_add_uint_format(tree, hf_proto_msg, tvb, offset, len, msgval, "%s", val_to_str(msgval, msg_vals, "Unknown %d"));
- Chris (FYI: I manually typed this example so it may not be exactly correct.)
References: doc/README.developer, section 1.7.1. epan/value_string.c,.h
From:
wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On
Behalf Of Martin Corraine (mcorrain)
Thanks Chris but I can't get the value_string to be outputted. Is there a way to tell the proto_tree_add_xxx_format()function to just output the value_string and nothing else?
Thanks, Martin From:
wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On
Behalf Of Maynard, Chris Have a look at section 1.6.2 of doc/README.developer or look at epan/proto.h. There are many functions of the form, “proto_tree_add_xxx_format()” that should enable you to display fields however you wish.
- Chris
From:
wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On
Behalf Of Martin Corraine (mcorrain)
Hello all,
When I display a field, can I have it display as follows: "Name of Message (42)" instead of like this: "Message Value: Name of Message (42)? I have another tree that encompasses these fields and I have no need to describe the field any further. I was think of just using a space but then I would have a random colon. In other words I want to just output the value_string. Appreciate any advice.
Thanks, Martin
CONFIDENTIALITY NOTICE: The contents of this email are confidential and for the exclusive use of the intended recipient. If you receive this email in error, please delete it from your system immediately and notify us either by email, telephone or fax. You should not copy, forward, or otherwise disclose the content of the email. CONFIDENTIALITY NOTICE: The contents of this email are confidential and for the exclusive use of the intended recipient. If you receive this email in error, please delete it from your system immediately and notify us either by email, telephone or fax. You should not copy, forward, or otherwise disclose the content of the email. |
- References:
- [Wireshark-dev] field reg
- From: Martin Corraine (mcorrain)
- Re: [Wireshark-dev] field reg
- From: Maynard, Chris
- Re: [Wireshark-dev] field reg
- From: Martin Corraine (mcorrain)
- [Wireshark-dev] field reg
- Prev by Date: Re: [Wireshark-dev] field reg
- Next by Date: [Wireshark-dev] dissecting multiple items inside one frame
- Previous by thread: Re: [Wireshark-dev] field reg
- Next by thread: [Wireshark-dev] WishList
- Index(es):
- Get Wireshark
- Download
- Code of Conduct