lwres_getrrsetbyname.html revision 89da2a56413ba6294315bdde04f7547b9d71b062
<!--
- Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2001 Internet Software Consortium.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: lwres_getrrsetbyname.html,v 1.10 2005/04/03 03:31:37 marka Exp $ -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>lwres_getrrsetbyname</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><H1
><A
NAME="AEN1"
></A
>lwres_getrrsetbyname</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8"
></A
><H2
>Name</H2
>lwres_getrrsetbyname, lwres_freerrset -- retrieve DNS records</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN12"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><P
></P
><A
NAME="AEN13"
></A
><PRE
CLASS="FUNCSYNOPSISINFO"
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int
lwres_getrrsetbyname</CODE
>(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res);</CODE
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>void
lwres_freerrset</CODE
>(struct rrsetinfo *rrset);</CODE
></P
><P
></P
></DIV
><P
>The following structures are used:
<PRE
CLASS="PROGRAMLISTING"
>struct rdatainfo {
unsigned int rdi_length; /* length of data */
unsigned char *rdi_data; /* record data */
};
struct rrsetinfo {
unsigned int rri_flags; /* RRSET_VALIDATED... */
unsigned int rri_rdclass; /* class number */
unsigned int rri_rdtype; /* RR type number */
unsigned int rri_ttl; /* time to live */
unsigned int rri_nrdatas; /* size of rdatas array */
unsigned int rri_nsigs; /* size of sigs array */
char *rri_name; /* canonical name */
struct rdatainfo *rri_rdatas; /* individual records */
struct rdatainfo *rri_sigs; /* individual signatures */
};</PRE
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN29"
></A
><H2
>DESCRIPTION</H2
><P
><CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>
gets a set of resource records associated with a
<CODE
CLASS="PARAMETER"
>hostname</CODE
>,
<CODE
CLASS="PARAMETER"
>class</CODE
>,
and
<CODE
CLASS="PARAMETER"
>type</CODE
>.
<CODE
CLASS="PARAMETER"
>hostname</CODE
>
is
a pointer a to null-terminated string. The
<CODE
CLASS="PARAMETER"
>flags</CODE
>
field is currently unused and must be zero.</P
><P
>After a successful call to
<CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>,
<CODE
CLASS="PARAMETER"
>*res</CODE
>
is a pointer to an
<SPAN
CLASS="TYPE"
>rrsetinfo</SPAN
>
structure, containing a list of one or more
<SPAN
CLASS="TYPE"
>rdatainfo</SPAN
>
structures containing resource records and potentially another list of
<SPAN
CLASS="TYPE"
>rdatainfo</SPAN
>
structures containing SIG resource records
associated with those records.
The members
<CODE
CLASS="CONSTANT"
>rri_rdclass</CODE
>
and
<CODE
CLASS="CONSTANT"
>rri_rdtype</CODE
>
are copied from the parameters.
<CODE
CLASS="CONSTANT"
>rri_ttl</CODE
>
and
<CODE
CLASS="CONSTANT"
>rri_name</CODE
>
are properties of the obtained rrset.
The resource records contained in
<CODE
CLASS="CONSTANT"
>rri_rdatas</CODE
>
and
<CODE
CLASS="CONSTANT"
>rri_sigs</CODE
>
are in uncompressed DNS wire format.
Properties of the rdataset are represented in the
<CODE
CLASS="CONSTANT"
>rri_flags</CODE
>
bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC
validated and the signatures verified. </P
><P
>All of the information returned by
<CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>
is dynamically allocated: the
<CODE
CLASS="CONSTANT"
>rrsetinfo</CODE
>
and
<CODE
CLASS="CONSTANT"
>rdatainfo</CODE
>
structures,
and the canonical host name strings pointed to by the
<CODE
CLASS="CONSTANT"
>rrsetinfo</CODE
>structure.
Memory allocated for the dynamically allocated structures created by
a successful call to
<CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>
is released by
<CODE
CLASS="FUNCTION"
>lwres_freerrset()</CODE
>.
<CODE
CLASS="PARAMETER"
>rrset</CODE
>
is a pointer to a
<SPAN
CLASS="TYPE"
>struct rrset</SPAN
>
created by a call to
<CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>. </P
><P
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN62"
></A
><H2
>RETURN VALUES</H2
><P
><CODE
CLASS="FUNCTION"
>lwres_getrrsetbyname()</CODE
>
returns zero on success, and one of the following error
codes if an error occurred:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><CODE
CLASS="CONSTANT"
>ERRSET_NONAME</CODE
></DT
><DD
><P
>the name does not exist</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>ERRSET_NODATA</CODE
></DT
><DD
><P
>the name exists, but does not have data of the desired type</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>ERRSET_NOMEMORY</CODE
></DT
><DD
><P
>memory could not be allocated</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>ERRSET_INVAL</CODE
></DT
><DD
><P
>a parameter is invalid</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>ERRSET_FAIL</CODE
></DT
><DD
><P
>other failure</P
></DD
><DT
><CODE
CLASS="CONSTANT"
></CODE
></DT
><DD
><P
></P
></DD
></DL
></DIV
> </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN97"
></A
><H2
>SEE ALSO</H2
><P
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres</SPAN
>(3)</SPAN
>.</P
></DIV
></BODY
></HTML
>