7
Martin Nagy <mnagy@redhat.com>
8
Jakub Hrozek <jhrozek@redhat.com>
10
Copyright (C) Red Hat, Inc 2009
12
This program is free software; you can redistribute it and/or modify
13
it under the terms of the GNU General Public License as published by
14
the Free Software Foundation; either version 3 of the License, or
15
(at your option) any later version.
17
This program is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
22
You should have received a copy of the GNU General Public License
23
along with this program. If not, see <http://www.gnu.org/licenses/>.
26
#ifndef __ASYNC_RESOLV_H__
27
#define __ASYNC_RESOLV_H__
34
#ifndef HAVE_ARES_DATA
35
#include "resolv/ares/ares_parse_srv_reply.h"
36
#include "resolv/ares/ares_parse_txt_reply.h"
37
#include "resolv/ares/ares_data.h"
38
#endif /* HAVE_ARES_DATA */
41
* An opaque structure which holds context for a module using the async
42
* resolver. Is should be used as a "local-global" variable - in sssd,
43
* every backend should have its own.
45
* Do NOT free the context until there are any pending resolv_ calls
49
int resolv_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx,
50
int timeout, struct resolv_ctx **ctxp);
52
void resolv_reread_configuration(void);
54
const char *resolv_strerror(int ares_code);
56
struct hostent *resolv_copy_hostent(TALLOC_CTX *mem_ctx,
59
/** Get host by name **/
60
enum restrict_family {
67
struct tevent_req *resolv_gethostbyname_send(TALLOC_CTX *mem_ctx,
68
struct tevent_context *ev,
69
struct resolv_ctx *ctx,
71
enum restrict_family family_order);
73
int resolv_gethostbyname_recv(struct tevent_req *req,
77
struct hostent **hostent);
79
/** Get SRV record **/
80
struct tevent_req *resolv_getsrv_send(TALLOC_CTX *mem_ctx,
81
struct tevent_context *ev,
82
struct resolv_ctx *ctx,
85
int resolv_getsrv_recv(TALLOC_CTX *mem_ctx,
86
struct tevent_req *req,
89
struct ares_srv_reply **reply_list);
91
/* This is an implementation of section "Usage rules" of RFC 2782 */
93
resolv_sort_srv_reply(TALLOC_CTX *mem_ctx, struct ares_srv_reply **reply);
95
/** Get TXT record **/
96
struct tevent_req *resolv_gettxt_send(TALLOC_CTX *mem_ctx,
97
struct tevent_context *ev,
98
struct resolv_ctx *ctx,
101
int resolv_gettxt_recv(TALLOC_CTX *mem_ctx,
102
struct tevent_req *req,
105
struct ares_txt_reply **reply_list);
107
#endif /* __ASYNC_RESOLV_H__ */