2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
4 .\" Permission to use, copy, modify, and distribute this
5 .\" software and its documentation for any purpose and without
6 .\" fee is hereby granted, provided that the above copyright
7 .\" notice appear in all copies and that both that copyright
8 .\" notice and this permission notice appear in supporting
9 .\" documentation, and that the name of M.I.T. not be used in
10 .\" advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.
12 .\" M.I.T. makes no representations about the suitability of
13 .\" this software for any purpose. It is provided "as is"
14 .\" without express or implied warranty.
16 .TH ARES_CREATE_QUERY 3 "17 Aug 2012"
18 ares_create_query \- Compose a single-question DNS query buffer
23 .B int ares_create_query(const char *\fIname\fP, int \fIdnsclass\fP,\
25 .B unsigned short \fIid\fP, int \fIrd\fP,\
26 unsigned char **\fIbuf\fP,
27 .B int *\fIbuflen\fP, int \fImax_udp_size\fP)
32 function composes a DNS query with a single question.
35 gives the query name as a NUL-terminated C string of period-separated
36 labels optionally ending with a period; periods and backslashes within
37 a label must be escaped with a backlash. The parameters
41 give the class and type of the query using the values defined in
42 .BR <arpa/nameser.h> .
45 gives a 16-bit identifier for the query. The parameter
47 should be nonzero if recursion is desired, zero if not. The query
48 will be placed in an allocated buffer, a pointer to which will be
49 stored in the variable pointed to by
51 and the length of which will be stored in the variable pointed to by
53 It is the caller's responsibility to free this buffer using
54 \fIares_free_string(3)\fP when it is no longer needed.
57 should be nonzero to activate EDNS. Usage of \fIares_create_query(3)\fP\ with
59 set to zero is equivalent to \fIares_mkquery(3)\fP.
62 can return any of the following values:
65 Construction of the DNS query succeeded.
70 could not be encoded as a domain name, either because it contained a
71 zero-length label or because it contained a label of more than 63
77 Added in c-ares 1.10.0
79 .BR ares_expand_name (3),
80 .BR ares_free_string (3)