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