views:

162

answers:

3

Hi all,

I'm trying to port a MacOSX app to windows and I've come up against a problem around getifaddrs. Basically windows does not support it. I'm trying to figure a way to re-implement it (for AF_INET and AF_INET6) but the "equivalent" functionality on windows appears to be nothing like the MacOSX support.

Has someone done this sort of conversion before? If so is there a nice way I can get windows to report me interface info like MacOSX does?

+1  A: 

maybe win32 port of libpcap can help you?

(or port of libnet, if one exists)

zed_0xff
Cheers i'll take a look :)
Goz
+3  A: 

The closest functions on Windows are GetAdaptersInfo and GetAdaptersAddresses. The MSDN documentation is pretty comprehensive, so you should find everything you need.

Laurent Etiemble
yeah I saw those. I'm slightly unsure how to get an IPv6 zone index from that info though ... I may have missed the obvious though.
Goz
+1  A: 

I've done it here, including a separate version for Wine as the IP version agnostic routines don't current work as expected,

http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/getifaddrs.c

LGPL 2.1 license

Steve-o