]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - libares/ares_mkquery.3
need automake as a build-dep, even though we don't use most of it
[1ts-debian.git] / libares / ares_mkquery.3
1 .\" $Id: ares_mkquery.3,v 1.5 2000/09/21 19:15:50 ghudson Exp $
2 .\"
3 .\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
4 .\"
5 .\" Permission to use, copy, modify, and distribute this
6 .\" software and its documentation for any purpose and without
7 .\" fee is hereby granted, provided that the above copyright
8 .\" notice appear in all copies and that both that copyright
9 .\" notice and this permission notice appear in supporting
10 .\" documentation, and that the name of M.I.T. not be used in
11 .\" advertising or publicity pertaining to distribution of the
12 .\" software without specific, written prior permission.
13 .\" M.I.T. makes no representations about the suitability of
14 .\" this software for any purpose.  It is provided "as is"
15 .\" without express or implied warranty.
16 .\"
17 .TH ARES_MKQUERY 3 "4 January 2000"
18 .SH NAME
19 ares_mkquery \- Compose a single-question DNS query buffer
20 .SH SYNOPSIS
21 .nf
22 .B #include <ares.h>
23 .PP
24 .B
25 int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
26 .B
27         unsigned short \fIid\fP, int \fIrd\fP, char **\fIbuf\fP,
28         int *\fIbuflen\fP)
29 .fi
30 .SH DESCRIPTION
31 The
32 .B ares_mkquery
33 function composes a DNS query with a single question.
34 The parameter
35 .I name
36 gives the query name as a NUL-terminated C string of period-separated
37 labels optionally ending with a period; periods and backslashes within
38 a label must be escaped with a backlash.  The parameters
39 .I dnsclass
40 and
41 .I type
42 give the class and type of the query using the values defined in
43 .BR <arpa/nameser.h> .
44 The parameter
45 .I id
46 gives a 16-bit identifier for the query.  The parameter
47 .I rd
48 should be nonzero if recursion is desired, zero if not.  The query
49 will be placed in an allocated buffer, a pointer to which will be
50 stored in the variable pointed to by
51 .IR buf ,
52 and the length of which will be stored in the variable pointed to by
53 .IR buflen .
54 It is the caller's responsibility to free this buffer using
55 .B ares_free_string
56 when it is no longer needed.
57 .SH RETURN VALUES
58 .B ares_mkquery
59 can return any of the following values:
60 .TP 15
61 .B ARES_SUCCESS
62 Construction of the DNS query succeeded.
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_free_string (3)
76 .SH AUTHOR
77 Greg Hudson, MIT Information Systems
78 .br
79 Copyright 1998, 2000 by the Massachusetts Institute of Technology.