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, int alen)
13
14       void ares_send(ares_channel channel, const unsigned char *qbuf,
15            int qlen, ares_callback callback, void *arg)
16

DESCRIPTION

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

SEE ALSO

62       ares_process(3)
63

AUTHOR

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