Fix libcares.pc generation for static MingW* cross builds
[platform/upstream/c-ares.git] / ares_mkquery.3
1 .\"
2 .\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
3 .\"
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.
15 .\"
16 .TH ARES_MKQUERY 3 "20 Nov 2009"
17 .SH NAME
18 ares_mkquery \- Compose a single-question DNS query buffer
19 .SH SYNOPSIS
20 .nf
21 .B #include <ares.h>
22 .PP
23 .B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
24 .B      unsigned short \fIid\fP, int \fIrd\fP, unsigned char **\fIbuf\fP,
25 .B      int *\fIbuflen\fP)
26 .fi
27 .SH DESCRIPTION
28 The
29 .B ares_mkquery
30 function composes a DNS query with a single question.
31 The parameter
32 .I name
33 gives the query name as a NUL-terminated C string of period-separated
34 labels optionally ending with a period; periods and backslashes within
35 a label must be escaped with a backlash.  The parameters
36 .I dnsclass
37 and
38 .I type
39 give the class and type of the query using the values defined in
40 .BR <arpa/nameser.h> .
41 The parameter
42 .I id
43 gives a 16-bit identifier for the query.  The parameter
44 .I rd
45 should be nonzero if recursion is desired, zero if not.  The query
46 will be placed in an allocated buffer, a pointer to which will be
47 stored in the variable pointed to by
48 .IR buf ,
49 and the length of which will be stored in the variable pointed to by
50 .IR buflen .
51 It is the caller's responsibility to free this buffer using
52 \fIares_free_string(3)\fP when it is no longer needed.
53 .SH RETURN VALUES
54 .B ares_mkquery
55 can return any of the following values:
56 .TP 15
57 .B ARES_SUCCESS
58 Construction of the DNS query succeeded.
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 SEE ALSO
70 .BR ares_expand_name (3),
71 .BR ares_free_string (3)
72 .SH AUTHOR
73 Greg Hudson, MIT Information Systems
74 .br
75 Copyright 1998, 2000 by the Massachusetts Institute of Technology.