bool Jumpropes::JRresolveAll( LookupObject *aDestIpArray ) { hostent *remoteHost; bool bSuccess = false; // gethostbyname() only retreives IPv4 addresses under Microsoft Windows and is deprecated as well remoteHost = gethostbyname( aDestIpArray->name.getValue() ); if ( remoteHost != NULL ) { int i = 0; char *pAddr = remoteHost->h_addr_list[i]; while ( pAddr != NULL ) { IPAddress *address = new IPAddress(); address->family = remoteHost->h_addrtype; if ( address->family == AF_INET ) { address->ip.setSize( INET_ADDRSTRLEN ); address->setAsIPv4Address( reinterpret_cast<in_addr *>( remoteHost->h_addr_list[i] ) ); inet_ntop( address->family, pAddr, address->ip.getPointer(0), INET_ADDRSTRLEN ); address->ip.setLength( strlen( address->ip.getValue() ) ); aDestIpArray->addElement( address ); bSuccess = true; } else if ( address->family == AF_INET6 ) { address->ip.setSize( INET6_ADDRSTRLEN ); address->setAsIPv6Address( reinterpret_cast<in6_addr *>( remoteHost->h_addr_list[i] ) ); inet_ntop( address->family, pAddr, address->ip.getPointer(0), INET6_ADDRSTRLEN ); address->ip.setLength( strlen( address->ip.getValue() ) ); aDestIpArray->addElement( address ); bSuccess = true; } i++; pAddr = remoteHost->h_addr_list[i]; } } if ( !bSuccess ) { return JRresolveAllWithGetAddrInfo( aDestIpArray ); } return bSuccess; }