Ethereal-dev: Re: [Ethereal-dev] pcap_next_ex patch

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

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Wed, 25 May 2005 23:38:16 +0200
Guy Harris wrote:

> Ulf Lamping wrote:
>
>> You mean libpcap? I would think that the whole code should only be
>> compiled with WinPcap?!?
>>
>> ... and pcap_next_ex is marked as win32 only.
>
>
> That's out of date, at least as of libpcap 0.8, although
> pcap_dispatch() might work better than pcap_next_ex() if it can be
> used (as pcap_next_ex() is sort of like a call to pcap_dispatch() with
> a count of 1 and with a special callback routine).

But there's a bug in 3.1b4 pcap_dispatch in WinPcap, see below.

>
> WinPcap 3.1b4, at least, has
>
>     int      pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const
> u_char **);
>
> as it's based on libpcap 0.8 (although the final 3.1 release *might*
> be 0.9-based - but the last argument will still be a "const u_char **").
>
Hmmm, that's really great :-(

Now the whole story. It's started when I've tried to bring the rpcap
(remote capturing) feature from WinPcap to life, see
http://wiki.ethereal.com/CaptureSetup_2fWinPcapRemote

I've noticed that the pcap_dispatch() function doesn't provide any
packets from the remote capture device, while pcap_next_ex() does?!? I
would call this a bug in WinPcap 3.1 beta 4.

As I'm still using WinPcap 3.0 developers pack, the pcap_next_ex()
function is defined without const, while the 3.1b4 seems to be with.

So, adding const would produce a warning in the 3.0 devel pack and
without  a warning  in the 3.1b4 one :-(

As I don't have a better idea, I've added "const" at both places now and
hope that time will heal the warnings ;-)

Regards, ULFL