Blame ares_parse_a_reply.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_PARSE_A_REPLY 3 "25 July 1998"
Packit 514978
.SH NAME
Packit 514978
ares_parse_a_reply \- Parse a reply to a DNS query of type A
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
Packit 514978
.B 	struct hostent **\fIhost\fP,
Packit 514978
.B      struct ares_addrttl *\fIaddrttls\fP, int *\fInaddrttls\fP);
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_parse_a_reply
Packit 514978
function parses the response to a query of type A into a
Packit 514978
.BR "struct hostent"
Packit 514978
and/or an array of
Packit 514978
.BR "struct ares_addrttls" . 
Packit 514978
The parameters
Packit 514978
.I abuf
Packit 514978
and
Packit 514978
.I alen
Packit 514978
give the contents of the response.  The result is stored in allocated
Packit 514978
memory and a pointer to it stored into the variable pointed to by
Packit 514978
.IR host ,
Packit 514978
if host is nonnull.
Packit 514978
It is the caller's responsibility to free the resulting host structure
Packit 514978
using
Packit 514978
.BR ares_free_hostent (3)
Packit 514978
when it is no longer needed.
Packit 514978
.PP
Packit 514978
If
Packit 514978
.IR addrttls
Packit 514978
and
Packit 514978
.IR naddrttls
Packit 514978
are both nonnull,
Packit 514978
then up to *naddrttls
Packit 514978
.BR "struct ares_addrttl"
Packit 514978
records are stored in the array pointed to by addrttls,
Packit 514978
and then *naddrttls is set to the number of records so stored.
Packit 514978
Note that the memory for these records is supplied by the caller.
Packit 514978
.SH RETURN VALUES
Packit 514978
.B ares_parse_a_reply
Packit 514978
can return any of the following values:
Packit 514978
.TP 15
Packit 514978
.B ARES_SUCCESS
Packit 514978
The response was successfully parsed.
Packit 514978
.TP 15
Packit 514978
.B ARES_EBADRESP
Packit 514978
The response was malformatted.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENODATA
Packit 514978
The response did not contain an answer to the query.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENOMEM
Packit 514978
Memory was exhausted.
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_gethostbyname (3),
Packit 514978
.BR ares_free_hostent (3)
Packit 514978
.SH AUTHOR
Packit 514978
Greg Hudson, MIT Information Systems
Packit 514978
.br
Packit 514978
Copyright 1998 by the Massachusetts Institute of Technology.