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, int alen)
13
14       void ares_query(ares_channel channel, const char *name,
15            int dnsclass, int type, ares_callback callback,
16       void *arg)
17

DESCRIPTION

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

SEE ALSO

88       ares_process(3)
89

AUTHOR

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