- Android compile fixes

This commit is contained in:
Rangel Reale
2012-11-11 16:49:07 -02:00
parent 81b84ad71c
commit 8101b850dc
3 changed files with 22 additions and 0 deletions

View File

@@ -69,10 +69,12 @@ public:
};
// compile-time shield against misalignment
#ifndef POCO_ANDROID
poco_static_assert (offsetof(Header, code) == 0x01);
poco_static_assert (offsetof(Header, checksum) == 0x02);
poco_static_assert (offsetof(Header, id) == 0x04);
poco_static_assert (offsetof(Header, seq) == 0x06);
#endif
enum MessageType
{

View File

@@ -39,6 +39,16 @@
#ifndef Net_SocketDefs_INCLUDED
#define Net_SocketDefs_INCLUDED
#ifndef __THROW
# ifndef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) (0)
# endif
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# else
# define __THROW
# endif
#endif
#if defined(POCO_OS_FAMILY_WINDOWS)
#include "Poco/UnWindows.h"

View File

@@ -1276,7 +1276,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#include <sys/types.h>
#ifndef POCO_ANDROID // Android doesn't have <ifaddrs.h>
#include <ifaddrs.h>
#endif
#include <linux/if.h>
#include <linux/if_packet.h>
#include <net/if_arp.h>
@@ -1306,6 +1308,8 @@ static NetworkInterface::Type fromNative(unsigned arphrd)
}
}
#ifndef POCO_ANDROID
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
{
struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr;
@@ -1317,11 +1321,14 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
impl.setType(fromNative(sdl->sll_hatype));
}
#endif
}
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
{
#ifndef POCO_ANDROID
FastMutex::ScopedLock lock(_mutex);
Map result;
unsigned ifIndex = 0;
@@ -1420,6 +1427,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if (ifaces) freeifaddrs(ifaces);
return result;
#else
throw Poco::NotImplementedException("Not implemented in Android");
#endif
}