1ARES_SEND(3) Library Functions Manual ARES_SEND(3)
2
3
4
6 ares_send - Initiate a DNS query
7
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
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_ECANCELLED The query was cancelled.
43
44 ARES_EDESTRUCTION The name service channel channel is being destroyed;
45 the query will not be completed.
46
47 The callback argument timeouts reports how many times a query timed out
48 during the execution of the given request.
49
50 If the query completed, the callback argument abuf points to a result
51 buffer of length alen. If the query did not complete, abuf will be
52 NULL and alen will be 0.
53
54 Unless the flag ARES_FLAG_NOCHECKRESP was set at channel initialization
55 time, ares_send will normally ignore responses whose questions do not
56 match the questions in qbuf, as well as responses with reply codes of
57 SERVFAIL, NOTIMP, and REFUSED. Unlike other query functions in the
58 ares library, however, ares_send does not inspect the header of the
59 reply packet to determine the error status, so a callback status of
60 ARES_SUCCESS does not reflect as much about the response as for other
61 query functions.
62
64 ares_process(3)
65
67 Greg Hudson, MIT Information Systems
68 Copyright 1998 by the Massachusetts Institute of Technology.
69
70
71
72 25 July 1998 ARES_SEND(3)