tcpdump mailing list archives

Re: Add WinPcap specific functions like pcap_open() to libpcap on Windows for binary compatibility


From: Yang Luo <hsluoyb () gmail com>
Date: Fri, 1 Jul 2016 14:44:55 -0700

Hi Guy,


On Tue, Jun 28, 2016 at 10:10 AM, Guy Harris <guy () alum mit edu> wrote:

On Jun 27, 2016, at 11:22 PM, Yang Luo <hsluoyb () gmail com> wrote:

So my thought is we need to add back those functions to libpcap on
Windows, the related source code files are remote-ext.h, pcap-new.c, etc,
which don't exist in libpcap. So are we OK with this?

I am not OK with any solution that reintroduces the "pcap_md" structure.


OK. I have submitted a new PR:
https://github.com/the-tcpdump-group/libpcap/pull/512.
It moved the "pcap_md" structure to "pcap-remote.c". As "pcap-win32.c"
already defined a priv structure of "pcap_win" type. So I put the "pcap_md"
structure right after "pcap_win". I hope this arrangement is appropriate?



The way libpcap works, and will continue to work, is that the pcap_t
structure has a "void *" member called "priv". Each pcap-XXX.c file
defines, internally, its own private data structure, allocates such a
structure, and sets "priv" to point to that structure.

The code that captures remotely with rpcap must do this for all the
information it needs.

Doing remote capture in an acceptable fashion, even if we don't generalize
it (as I intend to do in the future) to support multiple modules for
multiple protocols in addition to rpcap, is going to require significant
changes to the WinPcap remote-capture code.


I know the remote capture is only workable for Windows now. This is the
first step. You can generalize it to UN*X in the future version:)


You might have to, for now, maintain a temporary fork of the current
libpcap code, and remove your local changes once I've added an rpcap client
module to it.


I think we first need to integrate all WinPcap existing features into
libpcap, make them work at least on Windows, then generalize it to all
platforms by adding an rpcap client like what you said.


Cheers,
Yang
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: