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

NAME

6       ares_create_query - Compose a single-question DNS query buffer
7

SYNOPSIS

9       #include <ares.h>
10
11       int ares_create_query(const char *name, int dnsclass, int type,
12             unsigned short id, int rd, unsigned char **buf,
13             int *buflen, int max_udp_size)
14

DESCRIPTION

16       The ares_create_query function composes a DNS query with a single ques‐
17       tion.  The parameter name gives the query name as  a  NUL-terminated  C
18       string  of  period-separated  labels  optionally  ending with a period;
19       periods and backslashes within a label must be escaped with a backlash.
20       The  parameters  dnsclass and type give the class and type of the query
21       using the values defined in <arpa/nameser.h>.  The parameter id gives a
22       16-bit identifier for the query.  The parameter rd should be nonzero if
23       recursion is desired, zero if not.  The query  will  be  placed  in  an
24       allocated  buffer,  a  pointer  to which will be stored in the variable
25       pointed to by buf, and the length of which will be stored in the  vari‐
26       able  pointed  to by buflen.  It is the caller's responsibility to free
27       this buffer using ares_free_string(3) when it is no longer needed.  The
28       parameter  max_udp_size  should  be  nonzero to activate EDNS. Usage of
29       ares_create_query(3) with max_udp_size set to  zero  is  equivalent  to
30       ares_mkquery(3).
31

RETURN VALUES

33       ares_create_query can return any of the following values:
34
35       ARES_SUCCESS   Construction of the DNS query succeeded.
36
37       ARES_EBADNAME  The  query  name  name  could not be encoded as a domain
38                      name, either because it contained a zero-length label or
39                      because it contained a label of more than 63 characters.
40
41       ARES_ENOMEM    Memory was exhausted.
42

AVAILABILITY

44       Added in c-ares 1.10.0
45

SEE ALSO

47       ares_expand_name(3), ares_free_string(3)
48

AUTHOR

50                                  17 Aug 2012             ARES_CREATE_QUERY(3)
Impressum