Vineet,
From what I can tell, this would be the definitions that you need:
[StructLayout(LayoutKind.Sequential)]
public struct in_addr
{
public byte s_b1;
public byte s_b2;
public byte s_b3;
public byte s_b4;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct sockaddr_in
{
public short sin_family;
[MarshalAs(UnmanagedType.U2)]
public short sin_port;
public in_addr sin_addr;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=8)]
public string sin_zero;
}
[StructLayout(LayoutKind.Sequential)]
public struct pcap_addr
{
public IntPtr next;
public IntPtr addr;
public IntPtr netmask;
public IntPtr broadaddr;
public IntPtr dstaddr;
}
[StructLayout(LayoutKind.Sequential)]
public struct pcap_if
{
public IntPtr next;
public IntPtr name;
public IntPtr description;
public IntPtr addresses
[MarshalAs(UnmanagedType.U4)]
public int flags;
}
Now, you will have to marshal most of the information yourself
(basically, anything with an IntPtr type in the field). You might have some
better luck using some unsafe code, but all in all, this will be quite the
pain to use. You might want to create a C++ implementation which will
simplify the process, and then expose that to managed code.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Vineet S" <vi****@yahoo.co.uk> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
Hello friends,
i am doing a project in C# which involves accessing funtions and
structres from winpcap. so i would like some one to please help me to
access the pcap_if structure in my C# program. i have tried doing it by
DllImport but i am not able to do it.
Please help me its very urgent.
thank u all.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!