path: root/ares_mkquery.3
diff options
authorDaniel Stenberg <>2003-10-07 21:54:04 (GMT)
committerDaniel Stenberg <>2003-10-07 21:54:04 (GMT)
commit5e847a14bd65383ce65f143c578e120899981fd9 (patch)
tree0072e647fe22e05aee94cf4e4bf101209e30626c /ares_mkquery.3
ares 1.1.1 with collected applied patches
Diffstat (limited to 'ares_mkquery.3')
1 files changed, 79 insertions, 0 deletions
diff --git a/ares_mkquery.3 b/ares_mkquery.3
new file mode 100644
index 0000000..4483caa
--- /dev/null
+++ b/ares_mkquery.3
@@ -0,0 +1,79 @@
+.\" $Id$
+.\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
+.\" Permission to use, copy, modify, and distribute this
+.\" software and its documentation for any purpose and without
+.\" fee is hereby granted, provided that the above copyright
+.\" notice appear in all copies and that both that copyright
+.\" notice and this permission notice appear in supporting
+.\" documentation, and that the name of M.I.T. not be used in
+.\" advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.
+.\" M.I.T. makes no representations about the suitability of
+.\" this software for any purpose. It is provided "as is"
+.\" without express or implied warranty.
+.TH ARES_MKQUERY 3 "4 January 2000"
+ares_mkquery \- Compose a single-question DNS query buffer
+.B #include <ares.h>
+int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
+ unsigned short \fIid\fP, int \fIrd\fP, char **\fIbuf\fP,
+ int *\fIbuflen\fP)
+.B ares_mkquery
+function composes a DNS query with a single question.
+The parameter
+.I name
+gives the query name as a NUL-terminated C string of period-separated
+labels optionally ending with a period; periods and backslashes within
+a label must be escaped with a backlash. The parameters
+.I dnsclass
+.I type
+give the class and type of the query using the values defined in
+.BR <arpa/nameser.h> .
+The parameter
+.I id
+gives a 16-bit identifier for the query. The parameter
+.I rd
+should be nonzero if recursion is desired, zero if not. The query
+will be placed in an allocated buffer, a pointer to which will be
+stored in the variable pointed to by
+.IR buf ,
+and the length of which will be stored in the variable pointed to by
+.IR buflen .
+It is the caller's responsibility to free this buffer using
+.B ares_free_string
+when it is no longer needed.
+.B ares_mkquery
+can return any of the following values:
+.TP 15
+Construction of the DNS query succeeded.
+.TP 15
+The query name
+.I name
+could not be encoded as a domain name, either because it contained a
+zero-length label or because it contained a label of more than 63
+.TP 15
+Memory was exhausted.
+.BR ares_expand_name (3),
+.BR ares_free_string (3)
+Greg Hudson, MIT Information Systems
+Copyright 1998, 2000 by the Massachusetts Institute of Technology.