Ethereal-dev: Re: [Ethereal-dev] tvb_get_ntohl and other

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Tue, 21 Mar 2006 16:31:57 +0100 (CET)
Hi,

Comments in line...

On Tue, 21 Mar 2006, Sofia Altieri wrote:

> Hello List,
>
> I'm fetching all values defined in my proto with tvb_get_ntoh(l/s). This
> because this routine
> converts byte from *network* order to host order. Skimming through other
> dissectors I've noticed that tvb_get_letoh(l/s) routines are often used.
> Now:
>
> a) Why should I use tvb_get_letoh(l/s) routines if a more general
> tvb_get_ntoh(l/s) routine exists?
>

These were already answered, so that leaves reassembly.

> Other question:
>
> My proto refragments. I've used routines defined in reassemble.h to
> reassemble fragments.
> When sniffing, ethereal tells me which packets are fragments but it doesn't
> reassemble anything.
> it seems like it does not recognize the last packet and doesn't proceed with
> reassemblation.
>
> Before posting the code I'd like to solve it myself, then I'll ask u a
> couple of things
>
> 1) in fragment_add_seq_check (tvb, offset, pinfo, ....) what value must
> offset have? The beginning of packet? The beginning of the packet after the
> header? (In the first case shouldn'it always be set to 0?)

Offset is to have the value of the fragment data. The idea is that the
packet contains a header and a fragment. The header describes the
fragment, like that it is a fragment, which number it has, if it's the
last fragment. I think that is were you have a problem as well. You don't
seem to tell fragment_add_seq_check() that you there are no more fragments
to come. Therefor reassembly never completes.

> b) in process_reassembled_data (....., proto_tree * tree) must tree be an
> existent tree, like my proto_tree?

No, you don't have to have a tree != NULL.

Thanx,
Jaap