1ARES_QUERY(3)              Library Functions Manual              ARES_QUERY(3)
2
3
4

NAME

6       ares_query - Initiate a single-question DNS query
7

SYNOPSIS

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_query(ares_channel channel, const char *name,
16                       int dnsclass, int type,
17                       ares_callback callback, void *arg)
18

DESCRIPTION

20       The  ares_query  function  initiates a single-question DNS query on the
21       name service channel identified by channel.  The parameter  name  gives
22       the  query name as a NUL-terminated C string of period-separated labels
23       optionally ending with a period; periods and backslashes within a label
24       must  be  escaped  with  a backslash.  The parameters dnsclass and type
25       give the class and type of  the  query  using  the  values  defined  in
26       <arpa/nameser.h>.   When  the query is complete or has failed, the ares
27       library will invoke callback.  Completion or failure of the  query  may
28       happen   immediately,   or   may   happen   during   a  later  call  to
29       ares_process(3) or ares_destroy(3).
30
31       The callback argument arg is copied from the ares_query  argument  arg.
32       The callback argument status indicates whether the query succeeded and,
33       if not, how it failed.  It may have any of the following values:
34
35       ARES_SUCCESS       The query completed successfully.
36
37       ARES_ENODATA       The query completed but contains no answers.
38
39       ARES_EFORMERR      The query completed but the server claims  that  the
40                          query was malformatted.
41
42       ARES_ESERVFAIL     The  query  completed  but the server claims to have
43                          experienced a failure.  (This code can only occur if
44                          the  ARES_FLAG_NOCHECKRESP  flag  was  specified  at
45                          channel initialization  time;  otherwise,  such  re‐
46                          sponses are ignored at the ares_send(3) level.)
47
48       ARES_ENOTFOUND     The  query completed but the queried-for domain name
49                          was not found.
50
51       ARES_ENOTIMP       The query completed but the server does  not  imple‐
52                          ment  the  operation  requested by the query.  (This
53                          code can only  occur  if  the  ARES_FLAG_NOCHECKRESP
54                          flag  was  specified at channel initialization time;
55                          otherwise,  such  responses  are  ignored   at   the
56                          ares_send(3) level.)
57
58       ARES_EREFUSED      The  query  completed  but  the  server  refused the
59                          query.   (This  code   can   only   occur   if   the
60                          ARES_FLAG_NOCHECKRESP  flag was specified at channel
61                          initialization time; otherwise, such  responses  are
62                          ignored at the ares_send(3) level.)
63
64       ARES_EBADNAME      The query name name could not be encoded as a domain
65                          name, either because it contained a zero-length  la‐
66                          bel  or because it contained a label of more than 63
67                          characters.
68
69       ARES_ETIMEOUT      No name servers responded within the timeout period.
70
71       ARES_ECONNREFUSED  No name servers could be contacted.
72
73       ARES_ENOMEM        Memory was exhausted.
74
75       ARES_ECANCELLED    The query was cancelled.
76
77       ARES_EDESTRUCTION  The name service channel channel is being destroyed;
78                          the query will not be completed.
79
80       The callback argument timeouts reports how many times a query timed out
81       during the execution of the given request.
82
83       If the query completed (even if there was something wrong with  it,  as
84       indicated by some of the above error codes), the callback argument abuf
85       points to a result buffer of length alen.  If the query  did  not  com‐
86       plete, abuf will be NULL and alen will be 0.
87

SEE ALSO

89       ares_process(3)
90

AUTHOR

92       Greg Hudson, MIT Information Systems
93       Copyright 1998 by the Massachusetts Institute of Technology.
94
95
96
97                                 24 July 1998                    ARES_QUERY(3)
Impressum