[Winpcap-users] Pcap_list_datalinks return bad number of links.

Steve Beaudoin steve.a.beaudoin at gmail.com
Thu Aug 24 12:32:53 GMT 2006



            I am developing a winpcap library in C# with visual studio 2005
(and using the version 3.1 of winpcap) and the pcap_list_datalinks function
return the value 2, indicating the number of datalinks it found, but the
array return only one element.  


            I declared the import with this :


         // WinPCap : int pcap_list_datalinks(pcap_t *p, int **dlt_buf)


         internal extern static int pcap_list_datalinks(IntPtr pcapT, ref
int[] dlt_buf);


            And the code to retrieve the links is :


            IntPtr pcapT=OpenDevice(Target,Auth);

            int[] links=new int[] {};

            int result=NativeMethods.pcap_list_datalinks(pcapT,ref links); 


            The value return into result is 2, but the links array only have
one value (1 for Ethernet).


            The detailed information returned by ethereal for the same
network adapter (path : capture->interfaces->details) return only one media
supported (I suppose this is the name they use for datalink).


            I first thought it was because I used 32bits integer for my
array, but the symptoms are the same with 16bits bytes.


            So, either the returned value is wrong, or I'm missing a
datalink in my array, or I'm doing something wrong in the code.


            Someone have an idea before I dig into the winpcap source code?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060824/cd7641cb/attachment.htm

More information about the Winpcap-users mailing list