Wireshark-dev: Re: [Wireshark-dev] bytes
From: "Abhik Sarkar" <[email protected]>
Date: Tue, 8 Jan 2008 17:33:08 +0400
Hi,

Perhaps what you can try is something like this:
- tvb_memcpy the 9 address bytes into a new byte array (let's say the
array is called address_bytes).
- then use something like this:
 proto_tree_add_bytes_format_value(lon_tree, hf_unicast, tvb,
offset,9,lon_unicast,"0x%s",bytes_to_str(address_bytes));
where bytes_to_str comes from epan/strutil.h

Hope this helps
Abhik.

On Jan 8, 2008 5:20 PM, bijjou2000 <[email protected]> wrote:
> i do the same as you. the problem is the zero in behind of the address.
> can you tell me witch tvb_get_funktion is right in this case.
>
>
>
>
> > De: <[email protected]>
> > A: <[email protected]>
> > Objet: Re: [Wireshark-dev] bytes
> > Date: Tue, 8 Jan 2008 18:32:25 +0530
>
> > While trying to write a protocol dissector for a pseudo protocol , I
> > used this and it did work.
> > The packet (generated manually using text2pcap) had data in hex , and
> > the field value in the display was also getting displayed in hex . So I
> > did not do any special formatting for it .I think due to the FT_BYTES,
> > the data is simply displayed as hex.
> >
> >
> >
> > -----Original Message-----
> > From: <a href=mailto:"[email protected]";>[email protected]</a>
> > [mailto:[email protected]] On Behalf Of bijjou2000
> > Sent: Tuesday, January 08, 2008 6:22 PM
> > To: wireshark-dev
> > Subject: Re: [Wireshark-dev] bytes
> >
> > thanks for your help, but with proto_tree_add_item is formatting not
> > possible.  and i muss display it with a 0x......... form.
> >
> >
> >
> >
> > > De: <[email protected]>
> > > A: <w<a href=mailto:"[email protected]";>[email protected]</a>>
> > > Objet: Re: [Wireshark-dev] bytes
> > > Date: Tue, 8 Jan 2008 18:09:39 +0530
> >
> > > You may try the following
> > >
> > >
> > > proto_tree_add_item(xxx_tree, hf_xxx_abc,parameter_tvb, param_offset,
> > > 9, FALSE);
> > >
> > >
> > > { &hf_xxx_abc,
> > >    {    "ABC",      "xxx.abc",      FT_BYTES,       BASE_DEC,
> > > NULL,   0x0,    "",     HFILL }},
> > >
> > > Hopefully the above will help you display the 9 bytes .
> > >
> > >
> > > -----Original Message-----
> > > From: <a
>
> > > href=mailto:";<a href=mailto:"[email protected]";>[email protected]</a>">wireshark-dev-bounce
> > > [email protected]</a> [mailto:[email protected]] On
> > > Behalf Of bijjou2000
> > > Sent: Tuesday, January 08, 2008 5:58 PM
> > > To: wireshark-dev
> > > Subject: [Wireshark-dev] bytes
> > >
> > > hi I want spend a 9 bytes address as a hex value (0x. ....) , I tried
> > > as follows; proto_tree_add_bytes_format_value(lon_tree, hf_unicast,
> > > tvb, offset,9,lon_unicast,"0xX",lon_unicast); { &hf_unicast, {
> > > "Unicast", "lon.Unicast", FT_BYTES, BASE_HEX ,NULL, 0x0, "unicast",
> > > HFILL } }, i don't know what kind of tvb_get_xxx funktion ,is usefull
> > > . they unfortunately do I get an error. Do not know why! I would be
> > > grateful for your help. bijjou
> > >
> > >
> > >
> > > The information contained in this electronic message and any
> > > attachments to this message are intended for the exclusive use of the
> > > addressee(s) and may contain proprietary, confidential or privileged
> > > information. If you are not the intended recipient, you should not
> > > disseminate, distribute or copy this e-mail. Please notify the sender
> > > immediately and destroy all copies of this message and any
> > attachments.
> > >
> > > WARNING: Computer viruses can be transmitted via email. The recipient
> > > should check this email and any attachments for the presence of
> > viruses.
> > > The company accepts no liability for any damage caused by any virus
> > > transmitted by this email.
> > >
> > > www.wipro.com
> > >
> > > _______________________________________________
> > > Wireshark-dev mailing list
> > > <a
> > > href=mailto:";<a href=mailto:"[email protected]";>[email protected]</a>">[email protected]<
> > > /a>
> > > <a target="_blank"
> > > href='<a target="_blank"
> > href='http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://'>http
> > ://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://</a>
>
> > > www.wi reshark.org/mailman/listinfo/wireshark-dev</a>
> >
> >
> > The information contained in this electronic message and any attachments to
> > this message are intended for the exclusive use of the addressee(s) and may
> > contain proprietary, confidential or privileged information. If you are not
> > the intended recipient, you should not disseminate, distribute or copy this
> > e-mail. Please notify the sender immediately and destroy all copies of this
> > message and any attachments.
> >
> > WARNING: Computer viruses can be transmitted via email. The recipient
> > should check this email and any attachments for the presence of viruses.
> > The company accepts no liability for any damage caused by any virus
> > transmitted by this email.
> >
> > www.wipro.com
> >
> > _______________________________________________
> > Wireshark-dev mailing list
> > <a href=mailto:"[email protected]";>[email protected]</a>
> > <a target="_blank"
> > href='http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://www.wi
> > reshark.org/mailman/listinfo/wireshark-dev</a>
>
>
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>
>