On Sun, Feb 22, 2004 at 11:35:21PM +0100, Karl Sj�dahl wrote:
> if(pcap_open_live(device, BUFSIZ, PROMISC, 0, errbuf) == -1)
> {
> error handling
> }
"pcap_open_live()" doesn't return an integer, it returns a "pcap_t *" on
success, and NULL on failure; the "pcap_t *" is what you have to use in
subsequent calls to "pcap_compile()", "pcap_setfilter()",
"pcap_dispatch()"/"pcap_loop()"/"pcap_next()", etc..
Thus, that call should be
p = pcap_open_live(device, BUFSIZ, PROMISC, 0, errbuf);
if (p == NULL
{
error handling
}
and that "p" (which should be a "pcap_t *") is what should be used in
subsequent calls such as
> if(pcap_compile(p, &filter_code, TESTFILTER, 0, netmask) == -1)
> {
> error handling
> }
> if(pcap_setfilter(p, &filter_code) == -1)
> {
> error handling
> }
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]