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

Wireshark-dev: Re: [Wireshark-dev] VALS

From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Sun, 11 Nov 2007 22:14:07 -0500
It's hard to tell why it's not working without some code to look at it.  At a minimum, what does your value_string array look like, how are you attempting to add the "cnp code" to your flags_tree, and what is the hf_register_info array entry where VALS is used?
 
You should have something like the following:
 
static int hf_yourproto_flags_code = -1;
static const value_string code_vals[] = {
    {0x00, "CNP"},
    {0x01, "CNP2"},
    {0x02, "CNP3"},
    {0, NULL}
};
 
.... 
 
static gboolean dissect_yourproto(...) {
    ...
    proto_tree_add_item(flags_tree, hf_yourproto_flags_code, tvb, offset, 1, FALSE);
    ...
}
....
 
void proto_register_yourproto(void) {
    static hf_register_info hf[] = {
        ...
        {&hf_yourproto_flags_code,
            {"Code", "yourproto.flags.code", FT_UINT8, BASE_HEX,
            VALS(code_vals), 0x1F, "", HFILL}},
        ...
    };
}
 
Hope it helps.  If not, I suggest you post your code.
Chris

________________________________

From: wireshark-dev-bounces@xxxxxxxxxxxxx on behalf of khalid habibi
Sent: Sun 11/11/2007 6:58 PM
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] VALS


Hi 
When Bitweise decoding, I wille an issue as follows: 
The decoding is for 0x00 like: 
--------------------------- 
0 ... ....: Flag 1: Not Set 
..0 .. ....: Flag 2: Not Set 
... 0 ....: Flag 3: Not Set 
.... 0 0000: CODE: (0x00) CNP 
------------------------------ 
If CODE (lezte 5 bits) = 00000 (0x00) is CNP, 
If CODE = 00001 (0x01) CNP2 
If CODE = 00010 (0x02) CNP3 

I have tried it with VALS but it does not work. 
PLEASE help me. 
Thank you


Ink - Encre pour votre imprimante. Une ink cartouche à 0 EUR! Cliquez ici <http://ads.lycos-europe.com/event.ng/Type=click&FlightID=299563&AdID=582930&TargetID=74016&Segments=53878,4604,2789&Targets=74016&Values=24182,24195,25683,243,229&RawValues=&Redirect=http://www.inkclub.com/lycofr3> 




-----------------------------------------
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you
are not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data
corruption, interception, tampering, unauthorized amendment and
viruses. We only send and receive emails on the basis that we are
not liable for any such corruption, interception, tampering,
amendment or viruses or any consequence thereof.

<<winmail.dat>>