Wireshark-dev: Re: [Wireshark-dev] about udp dissector

From: "ronnie sahlberg" <ronniesahlberg@xxxxxxxxx>
Date: Fri, 2 Feb 2007 08:50:57 +0000
It was a technique we used previously to rotate between different
buffers without having to use g_malloc/g_free buffers.
Since there might be multiple UDP layers within one and the same
packet (UDP over UDP) we used this as a cheap method to make sure that
two or more consecutive calls to the UDP dissector would use different
buffers.

I have changed the udp dissector now to use the "modern" way to manage
short lived buffers that need not be explicitely freed using
ep_alloc() instead.





On 2/2/07, Vladimir Zherdenovsky <Vladimir.Zherdenovsky@xxxxxxxxxxxxxx> wrote:
Hello,



I just want to understand how the udp dissector works and have
misunderstanding of following codes lines:



  static e_udphdr udphstruct[4], *udph;
  static int udph_count=0;

  udph_count++;
  if(udph_count>=4){
     udph_count=0;
  }
  udph=&udphstruct[udph_count];



Could anybody explain why 4 and how it works?

Thanks,

vladimir