Ethereal-dev: Re: [Ethereal-dev] first patch for ip_to_str/tvb_get_ptr removal

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: Fri, 15 Jun 2001 20:04:02 -0700 (PDT)
> Adjustment for UDP/TCP pseudoheaders can be trivially implemented as
> a wrapper inside packet-tcp packet-udp (which calls tvb_ipchksum() and
> manually (trivially) adds the pseudoheader to the result).

That's the wrong way to do it.

The right way to do it would be to have a routine that takes a tvbuff_t
pointer, an offset, a length, and a count of additional vec_t members as
arguments, and returns a pointer to a mallocated vec_t that refers to
all the memory chunks, and also has some number of extra slots at the
beginning.  Then you just fill in the extra slots with pointer/length
pairs referring to the other data to be included in the checksum, and
hand it to "in_cksum()", freeing it when you're done.