1ARES_CREATE_QUERY(3) Library Functions Manual ARES_CREATE_QUERY(3)
2
3
4
6 ares_create_query - Compose a single-question DNS query buffer
7
9 #include <ares.h>
10
11 int ares_create_query(const char *name,
12 int dnsclass,
13 int type,
14 unsigned short id,
15 int rd,
16 unsigned char **buf,
17 int *buflen,
18 int max_udp_size)
19
21 The ares_create_query(3) function composes a DNS query with a single
22 question. The parameter name gives the query name as a NUL-terminated
23 C string of period-separated labels optionally ending with a period;
24 periods and backslashes within a label must be escaped with a backlash.
25
26 The parameters dnsclass and type give the class and type of the query
27 using the values defined in <arpa/nameser.h>.
28
29 The parameter id gives a 16-bit identifier for the query.
30
31 The parameter rd should be nonzero if recursion is desired, zero if
32 not.
33
34 The query will be placed in an allocated buffer, a pointer to which
35 will be stored in the variable pointed to by buf, and the length of
36 which will be stored in the variable pointed to by buflen.
37
38 It is the caller's responsibility to free this buffer using
39 ares_free_string(3) when it is no longer needed. The parameter
40 max_udp_size should be nonzero to activate EDNS. Usage of ares_cre‐
41 ate_query(3) with max_udp_size set to zero is equivalent to using
42 ares_mkquery(3).
43
45 ares_create_query can return any of the following values:
46
47 ARES_SUCCESS Construction of the DNS query succeeded.
48
49 ARES_EBADNAME The query name name could not be encoded as a domain
50 name, either because it contained a zero-length label or
51 because it contained a label of more than 63 characters.
52
53 ARES_ENOMEM Memory was exhausted.
54
56 Added in c-ares 1.10.0
57
59 ares_expand_name(3), ares_free_string(3), ares_mkquery(3)
60
62 17 Aug 2012 ARES_CREATE_QUERY(3)