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)
Sent: Monday, August 18, 2008 3:26
PM
To: Developer support list for
Wireshark
Subject: Re: [Wireshark-dev] field
reg
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
Sent: Monday, August 18, 2008
10:25 AM
To: Developer support list for
Wireshark
Subject: Re: [Wireshark-dev] field
reg
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)
Sent: Monday, August 18, 2008
10:08 AM
To: Developer support list for
Wireshark
Subject: [Wireshark-dev] field reg
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.
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.