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

NAME

6       ares_send - Initiate a 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_send(ares_channel channel, const unsigned char *qbuf,
16                      int qlen, ares_callback callback, void *arg)
17

DESCRIPTION

19       The  ares_send function initiates a DNS query on the name service chan‐
20       nel identified by channel.  The parameters qbuf and qlen give  the  DNS
21       query,  which  should  already have been formatted according to the DNS
22       protocol.  When the query is complete or has failed, the  ares  library
23       will  invoke  callback.   Completion or failure of the query may happen
24       immediately, or may happen during a later call  to  ares_process(3)  or
25       ares_destroy(3).
26
27       The  callback  argument  arg is copied from the ares_send argument arg.
28       The callback argument status indicates whether the query succeeded and,
29       if not, how it failed.  It may have any of the following values:
30
31       ARES_SUCCESS       The query completed.
32
33       ARES_EBADQUERY     The  query  buffer  was  poorly formed (was not long
34                          enough for a DNS header or  was  too  long  for  TCP
35                          transmission).
36
37       ARES_ETIMEOUT      No name servers responded within the timeout period.
38
39       ARES_ECONNREFUSED  No name servers could be contacted.
40
41       ARES_ENOMEM        Memory was exhausted.
42
43       ARES_ECANCELLED    The query was cancelled.
44
45       ARES_EDESTRUCTION  The name service channel channel is being destroyed;
46                          the query will not be completed.
47
48       The callback argument timeouts reports how many times a query timed out
49       during the execution of the given request.
50
51       If  the  query completed, the callback argument abuf points to a result
52       buffer of length alen.  If the query did not  complete,  abuf  will  be
53       NULL and alen will be 0.
54
55       Unless the flag ARES_FLAG_NOCHECKRESP was set at channel initialization
56       time, ares_send will normally ignore responses whose questions  do  not
57       match  the  questions in qbuf, as well as responses with reply codes of
58       SERVFAIL, NOTIMP, and REFUSED.  Unlike other  query  functions  in  the
59       ares library, however, ares_send does not inspect the header of the re‐
60       ply packet to determine the error  status,  so  a  callback  status  of
61       ARES_SUCCESS  does  not reflect as much about the response as for other
62       query functions.
63

SEE ALSO

65       ares_process(3)
66

AUTHOR

68       Greg Hudson, MIT Information Systems
69       Copyright 1998 by the Massachusetts Institute of Technology.
70
71
72
73                                 25 July 1998                     ARES_SEND(3)
Impressum