Blame ares_parse_ptr_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_PTR_REPLY 3 "25 July 1998"
Packit 514978
.SH NAME
Packit 514978
ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
Packit 514978
.B 	const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP,
Packit 514978
.B	struct hostent **\fIhost\fP);
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_parse_ptr_reply
Packit 514978
function parses the response to a query of type PTR into a
Packit 514978
.BR "struct hostent" .
Packit 514978
The parameters
Packit 514978
.I abuf
Packit 514978
and
Packit 514978
.I alen
Packit 514978
give the contents of the response.  The parameters
Packit 514978
.IR addr ,
Packit 514978
.IR addrlen ,
Packit 514978
and
Packit 514978
.I family
Packit 514978
specify which address was queried for; they are not used to verify the
Packit 514978
response, merely used to fill in the address of the
Packit 514978
.BR "struct hostent" .
Packit 514978
The resulting
Packit 514978
.B struct hostent
Packit 514978
is stored in allocated memory and a pointer to it stored into the
Packit 514978
variable pointed to by
Packit 514978
.IR host .
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
.SH RETURN VALUES
Packit 514978
.B ares_parse_ptr_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_gethostbyaddr (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.