On Thu, 14 Apr 2005, nimalan s wrote:
> Hi,
> I am creating a customised protocol dissector on top
> of UDP.I have some basic doubts,in my protocol there
> is a particular field say parametertype which contains
> about seven types.The next field to it is parameter
> length which is of variable lengths(can be from 2 to
> 254 bytes) follwed by data field of length specified
> by parameter length.
So a basic "Tag, Length, Value" schema.
> Again after this I have the same
> set repeated from param type,length and data untill
> the end of the packet.(packet size not known)
Loop
> 1.could any one tell me how to use byte accessors to
> get data of these variable lengths.ie..,(which of the
> tvb_get_*** to use).
length = tvb_get_guint8(tvb, offset);
offset++;
if (tree) proto_tree_add_item(proto_tree, hf_data, tvb, offset, length, FALSE);
offset += length;
where
static hf_register_info hf[] =
......
{
&hf_data,
{
"Data", "proto.data",
FT_BYTES, BASE_HEX,
NULL, 0,
"data", HFILL
}
},
.......
> 2.How to return back to next param type routine,
> again after dissecting param data.
while(tvb_length_remaining(tvb, offset) > 0)
{
Dissect
}
Hope it helps
Jaap