Blame ares_parse_srv_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_SRV_REPLY 3 "4 August 2009"
Packit 514978
.SH NAME
Packit 514978
ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP,
Packit 514978
.B                          struct ares_srv_reply** \fIsrv_out\fP);
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_parse_srv_reply
Packit 514978
function parses the response to a query of type SRV into a
Packit 514978
linked list of
Packit 514978
.I struct ares_srv_reply 
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 srv_out .
Packit 514978
It is the caller's responsibility to free the resulting
Packit 514978
.IR srv_out
Packit 514978
structure when it is no longer needed using the function
Packit 514978
.B ares_free_data
Packit 514978
.PP
Packit 514978
The structure 
Packit 514978
.I ares_srv_reply
Packit 514978
contains the following fields:
Packit 514978
.sp
Packit 514978
.in +4n
Packit 514978
.nf
Packit 514978
struct ares_srv_reply {
Packit 514978
    struct ares_srv_reply  *next;
Packit 514978
    unsigned short weight;
Packit 514978
    unsigned short priority;
Packit 514978
    unsigned short port;
Packit 514978
    char *host;
Packit 514978
};
Packit 514978
.fi
Packit 514978
.in
Packit 514978
.PP
Packit 514978
.SH RETURN VALUES
Packit 514978
.B ares_parse_srv_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 AVAILABILITY
Packit 514978
This function was first introduced in c-ares version 1.7.0.
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_query (3)
Packit 514978
.BR ares_free_data (3)
Packit 514978
.SH AUTHOR
Packit 514978
Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com