/**
* @brief Enumerate all network interfaces
- * @param callback the callback function
+ *
+ * @param proc the callback function
+ * @param proc_cls closure for proc
*/
void
GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc,
- void *cls)
+ void *proc_cls)
{
#ifdef MINGW
PMIB_IFTABLE pTable;
{
char szEntry[1001];
DWORD dwIP = 0;
- int iItm;
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
BYTE bPhysAddr[MAXLEN_PHYSADDR];
char *pszIfName = NULL;
char dst[INET_ADDRSTRLEN];
+ struct sockaddr_in sa;
/* Get friendly interface name */
pAdapterInfo =
if (pszIfName)
free (pszIfName);
+ sa.sin_family = AF_INET;
+ sa.sin_addr.S_un.S_addr = dwIP;
+
if (GNUNET_OK !=
- proc (cls,
+ proc (proc_cls,
szEntry,
- pAddrTable->table[dwIfIdx].dwIndex == dwExternalNIC,
- NULL /* FIXME: pass actual IP address! */ ,
- 0))
+ pTable->table[dwIfIdx].dwIndex == dwExternalNIC,
+ (const struct sockaddr *) &sa,
+ sizeof (sa)))
break;
}
}
GlobalFree (pTable);
}
- return GNUNET_YES;
+ return;
#elif HAVE_GETIFADDRS && HAVE_FREEIFADDRS
struct ifaddrs *ifa_first;
+ struct ifaddrs *ifa_ptr;
socklen_t alen;
if (getifaddrs (&ifa_first) == 0)
{
- struct ifaddrs *ifa_ptr;
-
- ifa_ptr = ifa_first;
for (ifa_ptr = ifa_first; ifa_ptr != NULL; ifa_ptr = ifa_ptr->ifa_next)
{
if (ifa_ptr->ifa_name != NULL &&
alen = sizeof (struct sockaddr_in);
else
alen = sizeof (struct sockaddr_in6);
- if (GNUNET_OK != proc (cls,
+ if (GNUNET_OK != proc (proc_cls,
ifa_ptr->ifa_name,
0 == strcmp (ifa_ptr->ifa_name,
GNUNET_DEFAULT_INTERFACE),
a4.sin_family = AF_INET;
a4.sin_addr = v4;
if (GNUNET_OK !=
- proc (cls,
+ proc (proc_cls,
ifc,
0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE),
(const struct sockaddr *) &a4, sizeof (a4)))
a6.sin6_addr = v6;
fprintf (stderr, "procing %s\n", addrstr);
if (GNUNET_OK !=
- proc (cls,
+ proc (proc_cls,
ifc,
0 == strcmp (ifc, GNUNET_DEFAULT_INTERFACE),
(const struct sockaddr *) &a6, sizeof (a6)))