/*
SSSD
Async resolver header
Authors:
Martin Nagy <mnagy@redhat.com>
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) Red Hat, Inc 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASYNC_RESOLV_H__
#define __ASYNC_RESOLV_H__
#include <netdb.h>
#include <ares.h>
#include "config.h"
#ifndef RESOLV_DEFAULT_TTL
#endif /* RESOLV_DEFAULT_TTL */
#ifndef RESOLV_DEFAULT_SRV_TTL
#endif /* RESOLV_DEFAULT_SRV_TTL */
/*
* An opaque structure which holds context for a module using the async
* resolver. Is should be used as a "local-global" variable - in sssd,
* every backend should have its own.
* Do NOT free the context until there are any pending resolv_ calls
*/
struct resolv_ctx;
const char *resolv_strerror(int ares_code);
struct resolv_hostent *
struct resolv_hostent *
int family, void *ares_ttl_data,
int num_ares_ttl_data);
/** Get host by name **/
enum host_database {
};
enum restrict_family {
};
/* If resolv_hostent->family is AF_INET, then ipaddr points to
* struct in_addr, else if family is AF_INET6, ipaddr points to
* struct in6_addr
*/
struct resolv_addr {
int ttl;
};
struct resolv_hostent {
};
/* The default database order */
extern enum host_database default_host_dbs[];
struct tevent_context *ev,
struct resolv_ctx *ctx,
const char *name,
enum restrict_family family_order,
enum host_database *db);
struct resolv_hostent **rhostent);
char *
struct resolv_hostent *hostent,
unsigned int addrindex);
char *
struct sockaddr_storage *
struct resolv_hostent *hostent,
/** Get SRV record **/
struct tevent_context *ev,
struct resolv_ctx *ctx,
const char *query);
struct tevent_req *req,
int *status,
int *timeouts,
struct ares_srv_reply **reply_list,
/* This is an implementation of section "Usage rules" of RFC 2782 */
int
/** Get TXT record **/
struct tevent_context *ev,
struct resolv_ctx *ctx,
const char *query);
struct tevent_req *req,
int *status,
int *timeouts,
struct ares_txt_reply **reply_list);
/** Utils **/
struct tevent_req *
struct tevent_context *ev,
struct resolv_ctx *resolv_ctx,
const char *hostname,
enum host_database *host_dbs,
enum restrict_family family_order);
struct tevent_req *req,
char **_dns_domain);
struct tevent_req *
struct tevent_context *ev,
struct resolv_ctx *resolv_ctx,
const char *service,
const char *protocol,
const char **discovery_domains);
struct tevent_req *req,
struct ares_srv_reply **_reply_list,
char **_dns_domain);
bool
resolv_is_address(const char *name);
#endif /* __ASYNC_RESOLV_H__ */