From 5400f704df4cffaa8d024eb4ec4959677a69d71e Mon Sep 17 00:00:00 2001 From: Gary Servin Date: Thu, 30 Oct 2014 15:24:47 -0300 Subject: [PATCH] Do not use ifaddrs on Android as it is not natively supported --- clients/roscpp/src/libros/transport/transport.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clients/roscpp/src/libros/transport/transport.cpp b/clients/roscpp/src/libros/transport/transport.cpp index 599bea0ec5..deeb4c7bf7 100644 --- a/clients/roscpp/src/libros/transport/transport.cpp +++ b/clients/roscpp/src/libros/transport/transport.cpp @@ -34,11 +34,14 @@ #include "ros/transport/transport.h" #include "ros/console.h" -#include #include #include #include +#if !defined(__ANDROID__) +#include +#endif + #ifndef NI_MAXHOST #define NI_MAXHOST 1025 #endif @@ -68,6 +71,7 @@ Transport::Transport() gethostname(our_hostname, sizeof(our_hostname)-1); allowed_hosts_.push_back(std::string(our_hostname)); allowed_hosts_.push_back("localhost"); +#if !defined(__ANDROID__) // for ipv4 loopback, we'll explicitly search for 127.* in isHostAllowed() // now we need to iterate all local interfaces and add their addresses // from the getifaddrs manpage: (maybe something similar for windows ?) @@ -96,6 +100,7 @@ Transport::Transport() } allowed_hosts_.push_back(std::string(addr)); } +#endif } bool Transport::isHostAllowed(const std::string &host) const