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       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       If the query completed, the callback argument abuf points to  a  result
46       buffer  of  length  alen.   If the query did not complete, abuf will be
47       NULL and alen will be 0.
48
49       Unless the flag ARES_FLAG_NOCHECKRESP was set at channel initialization
50       time,  ares_send  will normally ignore responses whose questions do not
51       match the questions in qbuf, as well as responses with reply  codes  of
52       SERVFAIL,  NOTIMP,  and  REFUSED.   Unlike other query functions in the
53       ares library, however, ares_send does not inspect  the  header  of  the
54       reply  packet  to  determine  the error status, so a callback status of
55       ARES_SUCCESS does not reflect as much about the response as  for  other
56       query functions.
57

SEE ALSO

59       ares_process(3)
60

AUTHOR

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