diff options
Diffstat (limited to 'src/common/dns_utils.h')
-rw-r--r-- | src/common/dns_utils.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/common/dns_utils.h b/src/common/dns_utils.h index 1e726c80c..63bf25445 100644 --- a/src/common/dns_utils.h +++ b/src/common/dns_utils.h @@ -49,7 +49,7 @@ struct DNSResolverData; */ class DNSResolver { -public: +private: /** * @brief Constructs an instance of DNSResolver @@ -58,6 +58,8 @@ public: */ DNSResolver(); +public: + /** * @brief takes care of freeing C pointers and such */ @@ -119,16 +121,36 @@ public: */ static DNSResolver& instance(); + /** + * @brief Gets a new instance of DNSResolver + * + * @return returns a pointer to the new object + */ + static DNSResolver create(); + private: /** + * @brief gets all records of a given type from a DNS query for the supplied URL; + * if no such record is present returns an empty vector. + * + * @param url A string containing a URL to query for + * @param record_type the record type to retrieve (DNS_TYPE_A, etc) + * @param reader a function that converts a record data to a string + * + * @return A vector of strings containing the requested record; or an empty vector + */ + // TODO: modify this to accomodate DNSSEC + std::vector<std::string> get_record(const std::string& url, int record_type, std::string (*reader)(const char *,size_t), bool& dnssec_available, bool& dnssec_valid); + + /** * @brief Checks a string to see if it looks like a URL * * @param addr the string to be checked * * @return true if it looks enough like a URL, false if not */ - bool check_address_syntax(const char *addr); + bool check_address_syntax(const char *addr) const; DNSResolverData *m_data; }; // class DNSResolver |