From 1240496176a07e804c57d43926509d5ccbf0fc41 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 10 Jun 2011 14:05:45 +0200 Subject: Switch resolver to using resolv_hostent and honor TTL --- src/resolv/async_resolv.h | 56 ++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'src/resolv/async_resolv.h') diff --git a/src/resolv/async_resolv.h b/src/resolv/async_resolv.h index 00e1bdfb..907865f7 100644 --- a/src/resolv/async_resolv.h +++ b/src/resolv/async_resolv.h @@ -57,6 +57,29 @@ void resolv_reread_configuration(void); const char *resolv_strerror(int ares_code); +struct resolv_hostent * +resolv_copy_hostent(TALLOC_CTX *mem_ctx, struct hostent *src); + +struct resolv_hostent * +resolv_copy_hostent_ares(TALLOC_CTX *mem_ctx, struct hostent *src, + int family, void *ares_ttl_data, + int num_ares_ttl_data); + +/** Get host by name **/ +enum host_database { + DB_FILES, + DB_DNS, + + DB_SENTINEL +}; + +enum restrict_family { + IPV4_ONLY, + IPV4_FIRST, + IPV6_ONLY, + IPV6_FIRST +}; + /* 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 @@ -74,39 +97,22 @@ struct resolv_hostent { struct resolv_addr **addr_list; /* list of addresses */ }; -struct resolv_hostent * -resolv_copy_hostent2(TALLOC_CTX *mem_ctx, struct hostent *src); - -struct resolv_hostent * -resolv_copy_hostent_ares(TALLOC_CTX *mem_ctx, struct hostent *src, - int family, void *ares_ttl_data, - int num_ares_ttl_data); - -struct hostent *resolv_copy_hostent(TALLOC_CTX *mem_ctx, - struct hostent *src); - -/** Get host by name **/ -enum restrict_family { - IPV4_ONLY, - IPV4_FIRST, - IPV6_ONLY, - IPV6_FIRST -}; +/* The default database order */ +extern enum host_database default_host_dbs[]; struct tevent_req *resolv_gethostbyname_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct resolv_ctx *ctx, const char *name, - enum restrict_family family_order); + enum restrict_family family_order, + enum host_database *db); -int resolv_gethostbyname_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - int *status, - int *timeouts, - struct hostent **hostent); +int resolv_gethostbyname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + int *status, int *timeouts, + struct resolv_hostent **rhostent); char * -resolv_get_string_address(TALLOC_CTX *mem_ctx, struct hostent *hostent); +resolv_get_string_address(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent); /** Get SRV record **/ struct tevent_req *resolv_getsrv_send(TALLOC_CTX *mem_ctx, -- cgit