}
/**
- * @brief Check if hostname is already an IPv4 address. Will insert it into
- * #ResolvedHostAddressList.
- *
- * @param host_dns_address
- * @return bool True if already an ip, false if not
- **/
-bool DnsResolver::handle_ip_address()
-{
- BOOST_ASSERT( !HostDnsAddress.empty() );
-
- struct in_addr dummy_conversion;
-
- // Convert string to IP address
- // Note: IPv4 only
- if ( inet_aton(HostDnsAddress.c_str(), &dummy_conversion) != 0 )
- {
- std::list<HostAddress> new_host_list;
-
- HostAddress ip_host( HostDnsAddress, 86400 * 365); // set fake TTL to one year
- new_host_list.push_back( ip_host );
-
- // Activate new host list
- ResolvedHostAddressList.swap( new_host_list );
-
- GlobalLogger.info() << "host is already an IP: " << HostDnsAddress << endl;
-
- return true;
- }
-
- return false;
-}
-
-/**
* @brief Resolve the IPs from this DNS and build a list of these IPs.
*
* @return true if the host address could be resolved, or false otherwise.
return false;
}
+/**
+ * @brief Check if hostname is already an IPv4 address. Will insert it into
+ * #ResolvedHostAddressList.
+ *
+ * @param host_dns_address
+ * @return bool True if already an ip, false if not
+ **/
+bool DnsResolver::handle_ip_address()
+{
+ BOOST_ASSERT( !HostDnsAddress.empty() );
+
+ struct in_addr dummy_conversion;
+
+ // Convert string to IP address
+ // Note: IPv4 only
+ if ( inet_aton(HostDnsAddress.c_str(), &dummy_conversion) != 0 )
+ {
+ std::list<HostAddress> new_host_list;
+
+ HostAddress ip_host( HostDnsAddress, 86400 * 365); // set fake TTL to one year
+ new_host_list.push_back( ip_host );
+
+ // Activate new host list
+ ResolvedHostAddressList.swap( new_host_list );
+
+ GlobalLogger.info() << "host is already an IP: " << HostDnsAddress << endl;
+
+ return true;
+ }
+
+ return false;
+}
+
void DnsResolver::fill_answers_list(
const string &host_dns_address,
const string &name_server,
bool expired_resolved_ip();
private:
+ bool handle_ip_address();
+
void fill_answers_list(
const std::string &host_dns_address,
const std::string &name_server,
std::list<HostAddress> *resolved_host_address_list
);
- bool handle_ip_address();
private:
/// The list of IPs available to the host DNS.
std::list<HostAddress> ResolvedHostAddressList;