Blame ares_create_query.3

Packit 514978
.\"
Packit 514978
.\" Copyright 1998 by the Massachusetts Institute of Technology.
Packit 514978
.\"
Packit 514978
.\" Permission to use, copy, modify, and distribute this
Packit 514978
.\" software and its documentation for any purpose and without
Packit 514978
.\" fee is hereby granted, provided that the above copyright
Packit 514978
.\" notice appear in all copies and that both that copyright
Packit 514978
.\" notice and this permission notice appear in supporting
Packit 514978
.\" documentation, and that the name of M.I.T. not be used in
Packit 514978
.\" advertising or publicity pertaining to distribution of the
Packit 514978
.\" software without specific, written prior permission.
Packit 514978
.\" M.I.T. makes no representations about the suitability of
Packit 514978
.\" this software for any purpose.  It is provided "as is"
Packit 514978
.\" without express or implied warranty.
Packit 514978
.\"
Packit 514978
.TH ARES_CREATE_QUERY 3 "17 Aug 2012"
Packit 514978
.SH NAME
Packit 514978
ares_create_query \- Compose a single-question DNS query buffer
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
#include <ares.h>
Packit 514978
Packit 514978
int ares_create_query(const char *\fIname\fP,
Packit 514978
                      int \fIdnsclass\fP,
Packit 514978
                      int \fItype\fP,
Packit 514978
                      unsigned short \fIid\fP,
Packit 514978
                      int \fIrd\fP,
Packit 514978
                      unsigned char **\fIbuf\fP,
Packit 514978
                      int *\fIbuflen\fP,
Packit 514978
                      int \fImax_udp_size\fP)
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The \fIares_create_query(3)\fP function composes a DNS query with a single
Packit 514978
question.  The parameter \fIname\fP gives the query name as a NUL-terminated C
Packit 514978
string of period-separated labels optionally ending with a period; periods and
Packit 514978
backslashes within a label must be escaped with a backlash.
Packit 514978
Packit 514978
The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the
Packit 514978
query using the values defined in \fB<arpa/nameser.h>\fP.
Packit 514978
Packit 514978
The parameter \fIid\fP gives a 16-bit identifier for the query.
Packit 514978
Packit 514978
The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not.
Packit 514978
Packit 514978
The query will be placed in an allocated buffer, a pointer to which will be
Packit 514978
stored in the variable pointed to by \fIbuf\fP, and the length of which will
Packit 514978
be stored in the variable pointed to by \fIbuflen\fP.
Packit 514978
Packit 514978
It is the caller's responsibility to free this buffer using
Packit 514978
\fIares_free_string(3)\fP when it is no longer needed.  The parameter
Packit 514978
\fImax_udp_size\fP should be nonzero to activate EDNS. Usage of
Packit 514978
\fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent
Packit 514978
to using \fIares_mkquery(3)\fP.
Packit 514978
.SH RETURN VALUES
Packit 514978
.B ares_create_query
Packit 514978
can return any of the following values:
Packit 514978
.TP 15
Packit 514978
.B ARES_SUCCESS
Packit 514978
Construction of the DNS query succeeded.
Packit 514978
.TP 15
Packit 514978
.B ARES_EBADNAME
Packit 514978
The query name
Packit 514978
.I name
Packit 514978
could not be encoded as a domain name, either because it contained a
Packit 514978
zero-length label or because it contained a label of more than 63
Packit 514978
characters.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENOMEM
Packit 514978
Memory was exhausted.
Packit 514978
.SH AVAILABILITY
Packit 514978
Added in c-ares 1.10.0
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_expand_name (3),
Packit 514978
.BR ares_free_string (3),
Packit 514978
.BR ares_mkquery (3)
Packit 514978
.SH AUTHOR