ares_create_query.3 (2433B)
1 .\" 2 .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 .\" SPDX-License-Identifier: MIT 4 .\" 5 .TH ARES_CREATE_QUERY 3 "17 Aug 2012" 6 .SH NAME 7 ares_create_query \- Compose a single-question DNS query buffer 8 .SH SYNOPSIS 9 .nf 10 #include <ares.h> 11 12 int ares_create_query(const char *\fIname\fP, 13 int \fIdnsclass\fP, 14 int \fItype\fP, 15 unsigned short \fIid\fP, 16 int \fIrd\fP, 17 unsigned char **\fIbuf\fP, 18 int *\fIbuflen\fP, 19 int \fImax_udp_size\fP) 20 .fi 21 .SH DESCRIPTION 22 This function is deprecated as of c-ares 1.22, please use 23 \fIares_dns_record_create(3)\fP instead. 24 25 The \fIares_create_query(3)\fP function composes a DNS query with a single 26 question. The parameter \fIname\fP gives the query name as a NUL-terminated C 27 string of period-separated labels optionally ending with a period; periods and 28 backslashes within a label must be escaped with a backlash. 29 30 The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the 31 query using the values defined in \fB<arpa/nameser.h>\fP. 32 33 The parameter \fIid\fP gives a 16-bit identifier for the query. 34 35 The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not. 36 37 The query will be placed in an allocated buffer, a pointer to which will be 38 stored in the variable pointed to by \fIbuf\fP, and the length of which will 39 be stored in the variable pointed to by \fIbuflen\fP. 40 41 It is the caller's responsibility to free this buffer using 42 \fIares_free_string(3)\fP when it is no longer needed. The parameter 43 \fImax_udp_size\fP should be nonzero to activate EDNS. Usage of 44 \fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent 45 to using \fIares_mkquery(3)\fP. 46 .SH RETURN VALUES 47 .B ares_create_query 48 can return any of the following values: 49 .TP 15 50 .B ARES_SUCCESS 51 Construction of the DNS query succeeded. 52 .TP 15 53 .B ARES_ENOTFOUND 54 The query name 55 .I name 56 refers to a 57 .I .onion 58 domain name. See RFC 7686. 59 .TP 15 60 .B ARES_EBADNAME 61 The query name 62 .I name 63 could not be encoded as a domain name, either because it contained a 64 zero-length label or because it contained a label of more than 63 65 characters. 66 .TP 15 67 .B ARES_ENOMEM 68 Memory was exhausted. 69 .SH AVAILABILITY 70 Added in c-ares 1.10.0 71 .SH SEE ALSO 72 .BR ares_dns_record (3), 73 .BR ares_expand_name (3), 74 .BR ares_free_string (3), 75 .BR ares_mkquery (3)