Hi
On Wed, 14 Nov 2007 17:49:06 +0000, khalid habibi wrote
> i m a
beginner.
> I have the following output:
>
> DATA:
005F000103E5
> I will spend it in HEX also 0x.
> Because it has an variable length, I do not know how to do
this?
>
> proto_tree_add_item(application_tree, hf_data_nbyte, tvb, offset, -1,
pdu_ackd);
-1 means to the end of the tvb buffer.
In your case:
len = tvb_get_guint8(tvb, offset); // or tvb_get_ntohs(tvb, offset); if it's 16 bits and so on.
proto_tree_add_item(application_tree, hf_data_nbyte, tvb, offset, len,
pdu_ackd);
offset +=len;
or len +1, but you get the idea.
>
> { &hf_data_nbyte,
> { "DATA",
"lon.datum",
> FT_BYTES, BASE_HEX, NULL, 0,
>
"DATA", HFILL }
>
}
>
Didier
|