async_resolv.h revision eafbc66c2ff6365478e62a8df3fd005bf80e5c7b
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose Async resolver header
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose Martin Nagy <mnagy@redhat.com>
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose Jakub Hrozek <jhrozek@redhat.com>
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose Copyright (C) Red Hat, Inc 2009
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose This program is free software; you can redistribute it and/or modify
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose it under the terms of the GNU General Public License as published by
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose the Free Software Foundation; either version 3 of the License, or
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose (at your option) any later version.
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose This program is distributed in the hope that it will be useful,
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose GNU General Public License for more details.
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose You should have received a copy of the GNU General Public License
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher#endif /* RESOLV_DEFAULT_TTL */
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher#endif /* RESOLV_DEFAULT_SRV_TTL */
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher * An opaque structure which holds context for a module using the async
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher * resolver. Is should be used as a "local-global" variable - in sssd,
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher * every backend should have its own.
de9fa0156b6cad1c824803283f15dfc360fb3f64Stephen Gallagher * Do NOT free the context until there are any pending resolv_ calls
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Boseint resolv_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx,
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnikvoid resolv_reread_configuration(struct resolv_ctx *ctx);
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Boseresolv_copy_hostent(TALLOC_CTX *mem_ctx, struct hostent *src);
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Boseresolv_copy_hostent_ares(TALLOC_CTX *mem_ctx, struct hostent *src,
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnik/** Get host by name **/
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Bose/* If resolv_hostent->family is AF_INET, then ipaddr points to
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Bose * struct in_addr, else if family is AF_INET6, ipaddr points to
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Bose * struct in6_addr
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Bose struct resolv_addr **addr_list; /* list of addresses */
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce/* The default database order */
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorcestruct tevent_req *resolv_gethostbyname_send(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce const char *name,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorceint resolv_gethostbyname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorceresolv_get_string_address_index(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce unsigned int addrindex);
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorceresolv_get_string_ptr_address(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce#define resolv_get_string_address(mem_ctx, hostent) \
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce resolv_get_string_address_index(mem_ctx, hostent, 0)
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorceresolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce#define resolv_get_sockaddr_address(mem_ctx, rhostent, port) \
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce resolv_get_sockaddr_address_index(mem_ctx, rhostent, port, 0)
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce/** Get SRV record **/
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorcestruct tevent_req *resolv_getsrv_send(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce const char *query);
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnik/* This is an implementation of section "Usage rules" of RFC 2782 */
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnikresolv_sort_srv_reply(struct ares_srv_reply **reply);
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnik/** Get TXT record **/
9acfb09f7969a69f58bd45c856b01700541853caLukas Slebodnikstruct tevent_req *resolv_gettxt_send(TALLOC_CTX *mem_ctx,
64af76e2bef2565caa9738f675c108a4b3789237Simo Sorce const char *query);
02e38eae1b9cb5df2036a707dafd86f6047c17deSumit Boseerrno_t resolv_get_domain_recv(TALLOC_CTX *mem_ctx,
bd09ead65cded3207cf228c44a31bbc87c2979bdJakub Hrozekerrno_t resolv_discover_srv_recv(TALLOC_CTX *mem_ctx,
1b18a3fc310932e5afcdaa4bb401c8d368e79c0bSumit Bose#endif /* __ASYNC_RESOLV_H__ */