Ethereal-dev: Re: [Ethereal-dev] Patch for GTP

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 17 Sep 2001 13:37:58 -0700 (PDT)
> Please find enclosed diff to packet-gtp.c:
> 1. simplified and shorter names
> 2. fixed problem with filtering (consequence of 1st point)
> 3. added more charging tickets

Hmm.

Why, in "decode_gtp_data_req()", does each arm of the case statement do
a "tvb_length_remaining()" check?  Why not just let it dissect as far as
it can, and get an exception as soon as it can't dissect any more?

In fact, what it should probably do is, for each field, extract it, put
an entry into the protocol tree, and then handle the next field, rather
than fetching the entire header at the beginning and then, after it's
all been extracted, build the protocol tree items for all the fields.

By the way, wouldn't it be better to, when putting the record type into
the protocol tree, to use "val_to_str()" to put a description of the
record type, rather than just doing something such as

	proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)",
	    rectype, rectype);