Wireshark-dev: Re: [Wireshark-dev] bytes

From: "bijjou2000" <bijjou2000@xxxxxxxxxxxx>
Date: Tue, 8 Jan 2008 19:30:21 +0000
hi
i have  try it as follows, but it don't work :

guint8 address_bytes;
guint8 lon_unicast;

tvb_memcpy(tvb,(guint8 *)&lon_unicast, offset, 9);

proto_tree_add_bytes_format_value(lon_tree, hf_unicast, tvb,
offset,9,lon_unicast,"0x%s",bytes_to_str(address_bytes,9));


{hf_unicast,
{"unicast";
"lon.unicast",
FT_BYTES, BASE_HEX,NULL,0x0, "",HFILL}
},

thanks


> De: "Abhik Sarkar" <sarkar.abhik@xxxxxxxxx>
> A: "Developer support list for Wireshark" <wireshark-dev@xxxxxxxxxxxxx>
> Objet: Re: [Wireshark-dev] bytes
> 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 <<a href=mailto:"bijjou2000@xxxxxxxxxxxx";>bijjou2000@xxxxxxxxxxxx</a>> 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: <jaiswal.vikash@xxxxxxxxx>
> > > A: <w<a href=mailto:"ireshark-dev@xxxxxxxxxxxxx";>ireshark-dev@xxxxxxxxxxxxx</a>>
> > > 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:";<a href=mailto:"wireshark-dev-bounces@xxxxxxxxxxxxx";>wireshark-dev-bounces@xxxxxxxxxxxxx</a>">wireshark-dev-bounces@wire
> shark.org</a>
> > > [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] 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: <jaiswal.vikash@xxxxxxxxx>
> > > > A: <w<a
> href=mailto:";<a href=mailto:"ireshark-dev@xxxxxxxxxxxxx";>ireshark-dev@xxxxxxxxxxxxx</a>">ireshark-dev@xxxxxxxxxxxxx</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:"w<a href=mailto:"ireshark-dev-bounces@xxxxxxxxxxxxx";>ireshark-dev-bounces@xxxxxxxxxxxxx</a>">wireshark-dev-bounces@wire
> shark.org</a>">wireshark-dev-bounce
> > > > s@xxxxxxxxxxxxx</a> [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] 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:";<a href=mailto:"Wireshark-dev@xxxxxxxxxxxxx";>Wireshark-dev@xxxxxxxxxxxxx</a>">Wireshark-dev@xxxxxxxxxxxxx</a>">W
> ireshark-dev@xxxxxxxxxxxxx<
> > > > /a>
> > > > <a target="_blank"
> > > > href='<a target="_blank"
> > > href='<a target="_blank"
> href='http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://'>http
> '>http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://'>http</a>
> 
> > > ://www.wireshark.org/mailman/listinfo/wireshark-dev'><a target="_blank"
> href='http://'>http://</a></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:";<a href=mailto:"Wireshark-dev@xxxxxxxxxxxxx";>Wireshark-dev@xxxxxxxxxxxxx</a>">Wireshark-dev@xxxxxxxxxxxxx</a>
> > > <a target="_blank"
> > > href='<a target="_blank"
> href='http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://www.wi
> '>http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://www.wi</a>
> 
> > > reshark.org/mailman/listinfo/wireshark-dev</a>
> >
> >
> > _______________________________________________
> > Wireshark-dev mailing list
> > <a href=mailto:"Wireshark-dev@xxxxxxxxxxxxx";>Wireshark-dev@xxxxxxxxxxxxx</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
> <a href=mailto:"Wireshark-dev@xxxxxxxxxxxxx";>Wireshark-dev@xxxxxxxxxxxxx</a>
> <a target="_blank"
> href='http://www.wireshark.org/mailman/listinfo/wireshark-dev'>http://www.wi
> reshark.org/mailman/listinfo/wireshark-dev</a>