Add functions to lookup and reverse-lookup domain names and move the ldap discovery function into a separate class refs #6093