On Sep 25, 2007, at 4:33 AM, Varuna De Silva wrote:
1. How should I work around so that pcap_findalldevs() will add my
device in
the list?
If you're doing this on Windows, you will have to:
modify pcap_findalldevs() in fad-win32.c to, right before it does
if (ret == -1) {
/*
* We had an error; free the list we've been
constructing.
*/
if (devlist != NULL) {
pcap_freealldevs(devlist);
devlist = NULL;
}
}
do
if (ret != -1) {
/*
* We haven't had any errors yet; do any
platform-specific
* operations to add devices.
*/
if (pcap_platform_finddevs(&devlist, errbuf) < 0)
ret = -1;
}
Then add a routine to your pcap-xxx.c that, similarly to
septel_platform_finddevs(), adds your device to the list of devices,
and then add a routine to pcap-win32.c called
"pcap_platform_finddevs()" that calls your routine, similarly to the
Linux pcap_platform_finddevs() in pcap-linux.c.
If you're doing this on some form of UN*X, e.g. Linux, just add the
routine to your pcap-xxx.c and find the appropriate pcap-yyy.c and
modify its pcap_platform_finddevs() to call your routine.
2. What is the relationship between pcap_platform_finddevs() and
pcap_findalldevs() function
in this regard ?
pcap_findalldevs() is the routine that finds "standard" network
adapters (i.e., the ones that the OS's mechanism for enumerating
network adapters finds); pcap_platform_finddevs() is the routine that
finds other adapters for a particular platform.
3. How should I modify "pcap_platform_finddevs()" so that I get my
device
added?
See septel_platform_finddevs() for an example.
do I need to do this?
Yes.
4. Where are these two functions written, (pcap_findalldevs() I
found only
in fad32! Sorry
for this foolish question, But I was not able to figure it out)
They're in libpcap, but not in the current version of WinPcap, because
pcap-win32.c and fad-win32.c didn't have them. I've just checked
changes to pcap-win32.c and fad-win32.c into the main branch of
libpcap to add those routines; hopefully they'll appear in a future
version of WinPcap.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.