/* This file is part of Lcrzo.
*/

/*-------------------------------------------------------------*/

int lcrzo_priv_sniff_nextmnormal(lcrzo_sniff *psniff,

				 lcrzo_data *pdata,

				 lcrzo_int32 *pdatasize);

int lcrzo_priv_sniff_nextmnormal(lcrzo_sniff *psniff,

				 lcrzo_data *pdata,

				 lcrzo_int32 *pdatasize)

{ const lcrzo_uint8 *pptr;

  lcrzo_int32 hdr_caplen;



  {

#if LCRZODEF_LIBPCAPFROMREDHAT==1

  struct pcap_pkthdr hdr[3];

  /* In this function, we use an array for hdr, even if it

     should not be necessary. Indeed, there is an overflow 

     in libpcap package modified by RedHat, so we have

     to use this trick ... (note : there is no problem

     with tcpdump because they only use pcap_loop) */

  memset((char*)hdr, 0, 3*sizeof(struct pcap_pkthdr));

  pptr = pcap_next(psniff->ppcapt, &(hdr[1]));

  if (pptr==NULL) /*rien de present*/

  { return(LCRZO_ERR_OKTEMPDATAEND);

  }

  hdr_caplen=hdr[1].caplen;

#else

  struct pcap_pkthdr hdr;

  memset(&hdr, 0, sizeof(struct pcap_pkthdr));

  pptr = pcap_next(psniff->ppcapt, &hdr);

  if (pptr==NULL) /*rien de present*/

  { return(LCRZO_ERR_OKTEMPDATAEND);

  }

  hdr_caplen=hdr.caplen;

#endif

  }



  /* eventually modify header */

  lcrzo_er(lcrzo_priv_datalink_modifyheader(psniff->linktype,

					    pptr, hdr_caplen,

					    pdata, pdatasize));

 

  return(LCRZO_ERR_OK);

}


