Merge pull request #418 from teemu-kemppainen/develop

Using #include <linux/if.h> conflicts with other libraries and code that use #include <net/if.h>
This commit is contained in:
Günter Obiltschnig 2014-04-09 12:56:16 +02:00
commit b1bdf7f34c
2 changed files with 4 additions and 11 deletions

View File

@ -169,16 +169,9 @@
#include <netdb.h>
#if defined(POCO_OS_FAMILY_UNIX)
#if (POCO_OS == POCO_OS_LINUX)
// <linux/if.h> is needed by NetworkInterface for ifmap, ifreq and ifconf definitions
#include <linux/if.h>
// if_nametoindex and if_indextoname are needed by IPAddress and NetworkInterface
// we can't get them from <net/if.h> because of a conflict with <linux/if.h>, so
// we declare them here
extern "C"
{
extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
}
// Net/src/NetworkInterface.cpp changed #include <linux/if.h> to #include <net/if.h>
// no more conflict, can use #include <net/if.h> here
#include <net/if.h>
#elif (POCO_OS == POCO_OS_HPUX)
extern "C"
{

View File

@ -1369,7 +1369,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#ifndef POCO_ANDROID // Android doesn't have <ifaddrs.h>
#include <ifaddrs.h>
#endif
#include <linux/if.h>
#include <net/if.h>
#include <linux/if_packet.h>
#include <net/if_arp.h>
#include <iostream>