1ARES_SEARCH(3) Library Functions Manual ARES_SEARCH(3)
2
3
4
6 ares_search - Initiate a DNS query with domain search
7
9 #include <ares.h>
10
11 typedef void (*ares_callback)(void *arg, int status,
12 int timeouts, unsigned char *abuf,
13 int alen)
14
15 void ares_search(ares_channel channel, const char *name,
16 int dnsclass, int type,
17 ares_callback callback, void *arg)
18
20 The ares_search function initiates a series of single-question DNS
21 queries on the name service channel identified by channel, using the
22 channel's search domains as well as a host alias file given by the
23 HOSTALIAS environment variable. The parameter name gives the alias
24 name or the base of the query name as a NUL-terminated C string of pe‐
25 riod-separated labels; if it ends with a period, the channel's search
26 domains will not be used. Periods and backslashes within a label must
27 be escaped with a backslash. The parameters dnsclass and type give the
28 class and type of the query using the values defined in
29 <arpa/nameser.h>. When the query sequence is complete or has failed,
30 the ares library will invoke callback. Completion or failure of the
31 query sequence may happen immediately, or may happen during a later
32 call to ares_process(3) or ares_destroy(3).
33
34 The callback argument arg is copied from the ares_search argument arg.
35 The callback argument status indicates whether the query sequence ended
36 with a successful query and, if not, how the query sequence failed. It
37 may have any of the following values:
38
39 ARES_SUCCESS A query completed successfully.
40
41 ARES_ENODATA No query completed successfully; when the query was
42 tried without a search domain appended, a response
43 was returned with no answers.
44
45 ARES_EFORMERR A query completed but the server claimed that the
46 query was malformatted.
47
48 ARES_ESERVFAIL No query completed successfully; when the query was
49 tried without a search domain appended, the server
50 claimed to have experienced a failure. (This code
51 can only occur if the ARES_FLAG_NOCHECKRESP flag was
52 specified at channel initialization time; otherwise,
53 such responses are ignored at the ares_send(3)
54 level.)
55
56 ARES_ENOTFOUND No query completed successfully; when the query was
57 tried without a search domain appended, the server
58 reported that the queried-for domain name was not
59 found.
60
61 ARES_ENOTIMP A query completed but the server does not implement
62 the operation requested by the query. (This code
63 can only occur if the ARES_FLAG_NOCHECKRESP flag was
64 specified at channel initialization time; otherwise,
65 such responses are ignored at the ares_send(3)
66 level.)
67
68 ARES_EREFUSED A query completed but the server refused the query.
69 (This code can only occur returned if the
70 ARES_FLAG_NOCHECKRESP flag was specified at channel
71 initialization time; otherwise, such responses are
72 ignored at the ares_send(3) level.)
73
74 ARES_TIMEOUT No name servers responded to a query within the
75 timeout period.
76
77 ARES_ECONNREFUSED No name servers could be contacted.
78
79 ARES_ENOMEM Memory was exhausted.
80
81 ARES_ECANCELLED The query was cancelled.
82
83 ARES_EDESTRUCTION The name service channel channel is being destroyed;
84 the query will not be completed.
85
86 The callback argument timeouts reports how many times a query timed out
87 during the execution of the given request.
88
89 If a query completed successfully, the callback argument abuf points to
90 a result buffer of length alen. If the query did not complete success‐
91 fully, abuf will usually be NULL and alen will usually be 0, but in
92 some cases an unsuccessful query result may be placed in abuf.
93
95 ares_process(3)
96
98 Greg Hudson, MIT Information Systems
99 Copyright 1998 by the Massachusetts Institute of Technology.
100
101
102
103 24 July 1998 ARES_SEARCH(3)