2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

Removed statements to the effect that certain functions

perform assertion checks.  Such statements are inappropriate as they
document the implementation rather than the public interface.  The
functions are not required to perform assertion checks, but the caller
is required to pass arguments that conform to the API requirements.
This commit is contained in:
Andreas Gustafsson
2001-06-18 22:56:35 +00:00
parent 5dccc8b2a5
commit ac299c4f5c
19 changed files with 435 additions and 870 deletions

View File

@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--> -->
<!-- $Id: lwres_context.docbook,v 1.2 2001/04/10 21:51:25 bwelling Exp $ --> <!-- $Id: lwres_context.docbook,v 1.3 2001/06/18 22:56:16 gson Exp $ -->
<refentry> <refentry>
<refentryinfo> <refentryinfo>
@@ -207,10 +207,6 @@ allocates
<parameter>len</parameter> <parameter>len</parameter>
bytes of memory and if successful returns a pointer to the allocated bytes of memory and if successful returns a pointer to the allocated
storage. storage.
<function>lwres_context_allocmem()</function>
checks that
<parameter>len</parameter>
must be greater than 0.
<function>lwres_context_freemem()</function> <function>lwres_context_freemem()</function>
frees frees
<parameter>len</parameter> <parameter>len</parameter>

View File

@@ -171,7 +171,7 @@ is either a decimal port number or a service name as listed in
<TT <TT
CLASS="FILENAME" CLASS="FILENAME"
>/etc/services</TT >/etc/services</TT
>.&#13;</P >.</P
><P ><P
><TT ><TT
CLASS="PARAMETER" CLASS="PARAMETER"
@@ -184,7 +184,6 @@ is an optional pointer to a
CLASS="TYPE" CLASS="TYPE"
>struct addrinfo</SPAN >struct addrinfo</SPAN
>. >.
This structure can be used to provide hints concerning the type of socket This structure can be used to provide hints concerning the type of socket
that the caller supports or wishes to use. that the caller supports or wishes to use.
The caller can supply the following structure elements in The caller can supply the following structure elements in
@@ -420,7 +419,7 @@ and no name resolution should be attempted.</P
></DD ></DD
></DL ></DL
></DIV ></DIV
>&#13;</P ></P
><P ><P
>All other elements of the <SPAN >All other elements of the <SPAN
CLASS="TYPE" CLASS="TYPE"

View File

@@ -139,109 +139,58 @@ or NIS. The lightweight resolver does not currently implement
these functions; it only provides them as stub functions that always these functions; it only provides them as stub functions that always
return failure. return failure.
.PP .PP
\fBlwres_gethostbyname()\fR \fBlwres_gethostbyname()\fR and
and \fBlwres_gethostbyname2()\fR look up the hostname
\fBlwres_gethostbyname2()\fR
look up the hostname
\fIname\fR. \fIname\fR.
\fBlwres_gethostbyname()\fR \fBlwres_gethostbyname()\fR always looks for an IPv4
always looks for an IPv4 address while address while \fBlwres_gethostbyname2()\fR looks for an
\fBlwres_gethostbyname2()\fR address of protocol family \fIaf\fR: either
looks for an address of protocol family \fBPF_INET\fR or \fBPF_INET6\fR \(em IPv4 or IPV6
\fIaf\fR: addresses respectively. Successful calls of the functions return a
either \fBstruct hostent\fRfor the name that was looked up.
\fBPF_INET\fR \fBNULL\fR is returned if the lookups by
or \fBlwres_gethostbyname()\fR or
\fBPF_INET6\fR \fBlwres_gethostbyname2()\fR fail.
\(em IPv4 or IPV6 addresses respectively.
Successful calls of the functions return a
\fBstruct hostent\fRfor
the name that was looked up.
\fBNULL\fR
is returned if the lookups by
\fBlwres_gethostbyname()\fR
or
\fBlwres_gethostbyname2()\fR
fail.
.PP .PP
Reverse lookups of addresses are performed by Reverse lookups of addresses are performed by
\fBlwres_gethostbyaddr()\fR. \fBlwres_gethostbyaddr()\fR.
\fIaddr\fR \fIaddr\fR is an address of length
is an address of length \fIlen\fR bytes and protocol family
\fIlen\fR \fItype\fR \(em \fBPF_INET\fR or
bytes and protocol family
\fItype\fR \(em
\fBPF_INET\fR
or
\fBPF_INET6\fR. \fBPF_INET6\fR.
\fBlwres_gethostbyname_r()\fR \fBlwres_gethostbyname_r()\fR is a thread-safe function
is a thread-safe function for forward lookups. for forward lookups. If an error occurs, an error code is returned in
If an error occurs, an error code is returned in
\fI*error\fR. \fI*error\fR.
\fIresbuf\fR \fIresbuf\fR is a pointer to a \fBstruct
is a pointer to a hostent\fR which is initialised by a successful call to
\fBstruct hostent\fR
which is initialised by a successful call to
\fBlwres_gethostbyname_r()\fR . \fBlwres_gethostbyname_r()\fR .
\fIbuf\fR \fIbuf\fR is a buffer of length
is a buffer of length \fIlen\fR bytes which is used to store the
\fIlen\fR h_name, h_aliases, and
bytes which is used to store the h_addr_list elements of the \fBstruct
h_name, hostent\fR returned in \fIresbuf\fR.
h_aliases, Successful calls to \fBlwres_gethostbyname_r()\fR
and return \fIresbuf\fR,
h_addr_list which is a pointer to the \fBstruct hostent\fR it created.
elements of the
\fBstruct hostent\fR
returned in
\fIresbuf\fR.
Successful calls to
\fBlwres_gethostbyname_r()\fR
return
\fIresbuf\fR,
which is a pointer to the
\fBstruct hostent\fR
it created.
.PP .PP
\fBlwres_gethostbyaddr_r()\fR \fBlwres_gethostbyaddr_r()\fR is a thread-safe function
is a thread-safe function that performs a reverse lookup of address that performs a reverse lookup of address \fIaddr\fR
\fIaddr\fR which is \fIlen\fR bytes long and is of protocol
which is family \fItype\fR \(em \fBPF_INET\fR or
\fIlen\fR \fBPF_INET6\fR. If an error occurs, the error code is returned
bytes long in \fI*error\fR. The other function parameters are
and is of protocol family identical to those in \fBlwres_gethostbyname_r()\fR.
\fItype\fR \(em \fIresbuf\fR is a pointer to a \fBstruct
\fBPF_INET\fR hostent\fR which is initialised by a successful call to
or
\fBPF_INET6\fR.
If an error occurs, the error code is returned in
\fI*error\fR.
The other function parameters are identical to those in
\fBlwres_gethostbyname_r()\fR.
\fIresbuf\fR
is a pointer to a
\fBstruct hostent\fR
which is initialised by a successful call to
\fBlwres_gethostbyaddr_r()\fR. \fBlwres_gethostbyaddr_r()\fR.
\fIbuf\fR \fIbuf\fR is a buffer of length
is a buffer of length \fIlen\fR bytes which is used to store the
\fIlen\fR h_name, h_aliases, and
bytes which is used to store the h_addr_list elements of the \fBstruct
h_name, hostent\fR returned in \fIresbuf\fR. Successful
h_aliases, calls to \fBlwres_gethostbyaddr_r()\fR return
and \fIresbuf\fR, which is a pointer to the
h_addr_list \fBstruct hostent()\fR it created.
elements of the
\fBstruct hostent\fR
returned in
\fIresbuf\fR.
Successful calls to
\fBlwres_gethostbyaddr_r()\fR
return
\fIresbuf\fR,
which is a pointer to the
\fBstruct hostent()\fR
it created.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
The functions The functions
@@ -281,38 +230,18 @@ and
always return always return
\fBNULL\fR. \fBNULL\fR.
.PP .PP
Successful calls to Successful calls to \fBlwres_gethostbyname_r()\fR and
\fBlwres_gethostbyname_r()\fR \fBlwres_gethostbyaddr_r()\fR return
and \fIresbuf\fR, a pointer to the \fBstruct
\fBlwres_gethostbyaddr_r()\fR hostent\fR that was initialised by these functions. They return
return \fBNULL\fR if the lookups fail or if \fIbuf\fR
\fIresbuf\fR,
a pointer to the
\fBstruct hostent\fR
that was initialised by these functions.
They return
\fBNULL\fR
if the lookups fail
or if
\fIbuf\fR
was too small to hold the list of addresses and names referenced by was too small to hold the list of addresses and names referenced by
the the h_name, h_aliases, and
h_name, h_addr_list elements of the \fBstruct
h_aliases, hostent\fR. If \fIbuf\fR was too small, both
and \fBlwres_gethostbyname_r()\fR and
h_addr_list \fBlwres_gethostbyaddr_r()\fR set the global variable
elements of the \fBerrno\fR to ERANGE.
\fBstruct hostent\fR.
If
\fIbuf\fR
was too small, both
\fBlwres_gethostbyname_r()\fR
and
\fBlwres_gethostbyaddr_r()\fR
set the global variable
\fBerrno\fR
to
ERANGE.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBgethostent\fR(3), \fBgethostent\fR(3),

View File

@@ -311,70 +311,55 @@ return failure.</P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname()</TT >lwres_gethostbyname()</TT
> > and
and
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname2()</TT >lwres_gethostbyname2()</TT
> > look up the hostname
look up the hostname
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>name</I >name</I
></TT ></TT
>. >.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname()</TT >lwres_gethostbyname()</TT
> > always looks for an IPv4
always looks for an IPv4 address while address while <TT
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname2()</TT >lwres_gethostbyname2()</TT
> > looks for an
looks for an address of protocol family address of protocol family <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>af</I >af</I
></TT ></TT
>: >: either
either
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET</SPAN >PF_INET</SPAN
> > or <SPAN
or
<SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET6</SPAN >PF_INET6</SPAN
> > &mdash; IPv4 or IPV6
&mdash; IPv4 or IPV6 addresses respectively. addresses respectively. Successful calls of the functions return a
Successful calls of the functions return a
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct hostent</SPAN
>for >for the name that was looked up.
the name that was looked up.
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > is returned if the lookups by
is returned if the lookups by
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname()</TT >lwres_gethostbyname()</TT
> > or
or
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname2()</TT >lwres_gethostbyname2()</TT
> > fail.</P
fail.</P
><P ><P
>Reverse lookups of addresses are performed by >Reverse lookups of addresses are performed by
<TT <TT
@@ -386,56 +371,47 @@ CLASS="PARAMETER"
><I ><I
>addr</I >addr</I
></TT ></TT
> > is an address of length
is an address of length
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>len</I >len</I
></TT ></TT
> > bytes and protocol family
bytes and protocol family
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>type</I >type</I
></TT ></TT
> &mdash; > &mdash; <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET</SPAN >PF_INET</SPAN
> > or
or
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET6</SPAN >PF_INET6</SPAN
>. >.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
> > is a thread-safe function
is a thread-safe function for forward lookups. for forward lookups. If an error occurs, an error code is returned in
If an error occurs, an error code is returned in
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*error</I >*error</I
></TT ></TT
>. >.
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
> > is a pointer to a <SPAN
is a pointer to a
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
> hostent</SPAN
which is initialised by a successful call to > which is initialised by a successful call to
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
@@ -445,110 +421,84 @@ CLASS="PARAMETER"
><I ><I
>buf</I >buf</I
></TT ></TT
> > is a buffer of length
is a buffer of length
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>len</I >len</I
></TT ></TT
> > bytes which is used to store the
bytes which is used to store the
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_name</TT >h_name</TT
>, >, <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_aliases</TT >h_aliases</TT
>, >, and
and
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_addr_list</TT >h_addr_list</TT
> > elements of the <SPAN
elements of the
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
> hostent</SPAN
returned in > returned in <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
>. >.
Successful calls to <TT
Successful calls to
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
> >
return return <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
>, >,
which is a pointer to the <SPAN
which is a pointer to the
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct hostent</SPAN
> > it created.</P
it created.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyaddr_r()</TT >lwres_gethostbyaddr_r()</TT
> > is a thread-safe function
is a thread-safe function that performs a reverse lookup of address that performs a reverse lookup of address <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addr</I >addr</I
></TT ></TT
> >
which is which is <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>len</I >len</I
></TT ></TT
> > bytes long and is of protocol
bytes long family <TT
and is of protocol family
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>type</I >type</I
></TT ></TT
> &mdash; > &mdash; <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET</SPAN >PF_INET</SPAN
> > or
or
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>PF_INET6</SPAN >PF_INET6</SPAN
>. >. If an error occurs, the error code is returned
in <TT
If an error occurs, the error code is returned in
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*error</I >*error</I
></TT ></TT
>. >. The other function parameters are
identical to those in <TT
The other function parameters are identical to those in
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
>. >.
@@ -557,13 +507,11 @@ CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
> > is a pointer to a <SPAN
is a pointer to a
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
> hostent</SPAN
which is initialised by a successful call to > which is initialised by a successful call to
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyaddr_r()</TT >lwres_gethostbyaddr_r()</TT
@@ -573,62 +521,47 @@ CLASS="PARAMETER"
><I ><I
>buf</I >buf</I
></TT ></TT
> > is a buffer of length
is a buffer of length
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>len</I >len</I
></TT ></TT
> > bytes which is used to store the
bytes which is used to store the
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_name</TT >h_name</TT
>, >, <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_aliases</TT >h_aliases</TT
>, >, and
and
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_addr_list</TT >h_addr_list</TT
> > elements of the <SPAN
elements of the
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
> hostent</SPAN
returned in > returned in <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
>. >. Successful
calls to <TT
Successful calls to
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyaddr_r()</TT >lwres_gethostbyaddr_r()</TT
> > return
return
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
>, >, which is a pointer to the
which is a pointer to the
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>struct hostent()</TT >struct hostent()</TT
> > it created.</P
it created.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
@@ -739,95 +672,71 @@ always return
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
>.&#13;</P >.</P
><P ><P
>Successful calls to >Successful calls to <TT
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
> > and
and
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyaddr_r()</TT >lwres_gethostbyaddr_r()</TT
> > return
return
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>resbuf</I >resbuf</I
></TT ></TT
>, >, a pointer to the <SPAN
a pointer to the
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
> hostent</SPAN
that was initialised by these functions. > that was initialised by these functions. They return
They return
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > if the lookups fail or if <TT
if the lookups fail
or if
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>buf</I >buf</I
></TT ></TT
> >
was too small to hold the list of addresses and names referenced by was too small to hold the list of addresses and names referenced by
the the <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_name</TT >h_name</TT
>, >, <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_aliases</TT >h_aliases</TT
>, >, and
and
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>h_addr_list</TT >h_addr_list</TT
> > elements of the <SPAN
elements of the
<SPAN
CLASS="TYPE" CLASS="TYPE"
>struct hostent</SPAN >struct
>. hostent</SPAN
>. If <TT
If
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>buf</I >buf</I
></TT ></TT
> > was too small, both
was too small, both
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyname_r()</TT >lwres_gethostbyname_r()</TT
> > and
and
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_gethostbyaddr_r()</TT >lwres_gethostbyaddr_r()</TT
> > set the global variable
set the global variable
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>errno</SPAN >errno</SPAN
> > to <SPAN
to
<SPAN
CLASS="ERRORCODE" CLASS="ERRORCODE"
>ERANGE</SPAN >ERANGE</SPAN
>.&#13;</P >.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"

View File

@@ -109,7 +109,6 @@ which is defined in
CLASS="FILENAME" CLASS="FILENAME"
>namedb.h</TT >namedb.h</TT
>: >:
<PRE <PRE
CLASS="PROGRAMLISTING" CLASS="PROGRAMLISTING"
>struct hostent { >struct hostent {

View File

@@ -26,37 +26,21 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t ho
.ad .ad
\fR.SH "DESCRIPTION" \fR.SH "DESCRIPTION"
.PP .PP
This function is equivalent to the This function is equivalent to the \fBgetnameinfo\fR(3) function defined in RFC2133.
\fBgetnameinfo\fR(3) \fBlwres_getnameinfo()\fR returns the hostname for the
function defined in RFC2133. \fBstruct sockaddr\fR \fIsa\fR which is
\fBlwres_getnameinfo()\fR \fIsalen\fR bytes long. The hostname is of length
returns the hostname for the \fIhostlen\fR and is returned via
\fBstruct sockaddr\fR \fI*host.\fR The maximum length of the hostname is
\fIsa\fR 1025 bytes: NI_MAXHOST.
which is
\fIsalen\fR
bytes long.
The hostname is of length
\fIhostlen\fR
and is returned via
\fI*host.\fR
The maximum length of the hostname is
1025 bytes:
NI_MAXHOST.
.PP .PP
The name of the service associated with the port number in The name of the service associated with the port number in
\fIsa\fR \fIsa\fR is returned in \fI*serv.\fR
is returned in It is \fIservlen\fR bytes long. The maximum length
\fI*serv.\fR of the service name is NI_MAXSERV - 32 bytes.
It is
\fIservlen\fR
bytes long.
The maximum length of the service name is
NI_MAXSERV - 32 bytes.
.PP .PP
The The \fIflags\fR argument sets the following
\fIflags\fR bits:
argument sets the following bits:
.TP .TP
\fBNI_NOFQDN\fR \fBNI_NOFQDN\fR
A fully qualified domain name is not required for local hosts. A fully qualified domain name is not required for local hosts.
@@ -81,7 +65,6 @@ service, and causes getservbyport() to be called with a second
argument of "udp" instead of its default of "tcp". This is required argument of "udp" instead of its default of "tcp". This is required
for the few ports (512-514) that have different services for UDP and for the few ports (512-514) that have different services for UDP and
TCP. TCP.
.PP
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
\fBlwres_getnameinfo()\fR \fBlwres_getnameinfo()\fR

View File

@@ -79,95 +79,79 @@ NAME="AEN24"
><H2 ><H2
>DESCRIPTION</H2 >DESCRIPTION</H2
><P ><P
>This function is equivalent to the > This function is equivalent to the <SPAN
<SPAN
CLASS="CITEREFENTRY" CLASS="CITEREFENTRY"
><SPAN ><SPAN
CLASS="REFENTRYTITLE" CLASS="REFENTRYTITLE"
>getnameinfo</SPAN >getnameinfo</SPAN
>(3)</SPAN >(3)</SPAN
> > function defined in RFC2133.
function defined in RFC2133.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getnameinfo()</TT >lwres_getnameinfo()</TT
> > returns the hostname for the
returns the hostname for the
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>struct sockaddr</SPAN >struct sockaddr</SPAN
> > <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>sa</I >sa</I
></TT ></TT
> > which is
which is
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>salen</I >salen</I
></TT ></TT
> > bytes long. The hostname is of length
bytes long.
The hostname is of length
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>hostlen</I >hostlen</I
></TT ></TT
> > and is returned via
and is returned via
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*host.</I >*host.</I
></TT ></TT
> > The maximum length of the hostname is
The maximum length of the hostname is 1025 bytes: <TT
1025 bytes:
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>NI_MAXHOST</TT >NI_MAXHOST</TT
>.&#13;</P >.</P
><P ><P
>The name of the service associated with the port number in > The name of the service associated with the port number in
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>sa</I >sa</I
></TT ></TT
> > is returned in <TT
is returned in
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*serv.</I >*serv.</I
></TT ></TT
> >
It is It is <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>servlen</I >servlen</I
></TT ></TT
> > bytes long. The maximum length
bytes long. of the service name is <TT
The maximum length of the service name is
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>NI_MAXSERV</TT >NI_MAXSERV</TT
> - 32 bytes.</P > - 32 bytes.</P
><P ><P
>The > The <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>flags</I >flags</I
></TT ></TT
> > argument sets the following
argument sets the following bits: bits:
<P <P
></P ></P
><DIV ><DIV
@@ -230,13 +214,11 @@ TCP.</P
></DL ></DL
></DIV ></DIV
></P ></P
><P
></P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
><A ><A
NAME="AEN71" NAME="AEN70"
></A ></A
><H2 ><H2
>RETURN VALUES</H2 >RETURN VALUES</H2
@@ -250,7 +232,7 @@ returns 0 on success or a non-zero error code if an error occurs.</P
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
><A ><A
NAME="AEN75" NAME="AEN74"
></A ></A
><H2 ><H2
>SEE ALSO</H2 >SEE ALSO</H2
@@ -301,7 +283,7 @@ CLASS="REFENTRYTITLE"
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
><A ><A
NAME="AEN95" NAME="AEN94"
></A ></A
><H2 ><H2
>BUGS</H2 >BUGS</H2

View File

@@ -31,20 +31,14 @@ lwres_hstrerror(int err);
.ad .ad
\fR.SH "DESCRIPTION" \fR.SH "DESCRIPTION"
.PP .PP
\fBlwres_herror()\fR \fBlwres_herror()\fR prints the string
prints the string \fIs\fR on \fBstderr\fR followed by the string
\fIs\fR generated by \fBlwres_hstrerror()\fR for the error code
on stored in the global variable lwres_h_errno.
\fBstderr\fR
followed by the string generated by
\fBlwres_hstrerror()\fR
for the error code stored in the global variable
lwres_h_errno.
.PP .PP
\fBlwres_hstrerror()\fR \fBlwres_hstrerror()\fR returns an appropriate string
returns an appropriate string for the error code gievn by for the error code gievn by \fIerr\fR. The values of
\fIerr\fR. the error codes and messages are as follows:
The values of the error codes and messages are as follows:
.TP .TP
\fBNETDB_SUCCESS\fR \fBNETDB_SUCCESS\fR
\fBResolver Error 0 (no error)\fR \fBResolver Error 0 (no error)\fR

View File

@@ -90,43 +90,37 @@ NAME="AEN23"
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_herror()</TT >lwres_herror()</TT
> > prints the string
prints the string
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>s</I >s</I
></TT ></TT
> > on <SPAN
on
<SPAN
CLASS="TYPE" CLASS="TYPE"
>stderr</SPAN >stderr</SPAN
> > followed by the string
followed by the string generated by generated by <TT
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_hstrerror()</TT >lwres_hstrerror()</TT
> > for the error code
for the error code stored in the global variable stored in the global variable <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>lwres_h_errno</TT >lwres_h_errno</TT
>.&#13;</P >.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_hstrerror()</TT >lwres_hstrerror()</TT
> > returns an appropriate string
returns an appropriate string for the error code gievn by for the error code gievn by <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>err</I >err</I
></TT ></TT
>. >. The values of
the error codes and messages are as follows:
The values of the error codes and messages are as follows:
<P <P
></P ></P
><DIV ><DIV

View File

@@ -26,39 +26,25 @@ lwres_net_ntop(int af, const void *src, char *dst, size_t size);
.ad .ad
\fR.SH "DESCRIPTION" \fR.SH "DESCRIPTION"
.PP .PP
\fBlwres_net_ntop()\fR \fBlwres_net_ntop()\fR converts an IP address of
converts an IP address of protocol family protocol family \fIaf\fR \(em IPv4 or IPv6 \(em
\fIaf\fR at location \fIsrc\fR from network format to its
\(em IPv4 or IPv6 \(em conventional representation as a string. For IPv4 addresses, that
at location string would be a dotted-decimal. An IPv6 address would be
\fIsrc\fR represented in colon notation as described in RFC1884.
from network format to its conventional representation as a string.
For IPv4 addresses, that string would be a dotted-decimal.
An IPv6 address would be represented in colon notation as described in
RFC1884.
.PP .PP
The generated string is copied to The generated string is copied to \fIdst\fR provided
\fIdst\fR \fIsize\fR indicates it is long enough to store the
provided ASCII representation of the address.
\fIsize\fR
indicates it is long enough to store the ASCII representation
of the address.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
If successful, the function returns If successful, the function returns \fIdst\fR:
\fIdst\fR: a pointer to a string containing the presentation format of the
a pointer to a string containing address. \fBlwres_net_ntop()\fR returns
the presentation format of the address. \fBNULL\fR and sets the global variable
\fBlwres_net_ntop()\fR errno to EAFNOSUPPORT if
returns the protocol family given in \fIaf\fR is not
\fBNULL\fR supported.
and sets the global variable
errno
to
EAFNOSUPPORT
if the protocol family given in
\fIaf\fR
is not supported.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBRFC1884\fR, \fBRFC1884\fR,

View File

@@ -82,43 +82,36 @@ NAME="AEN21"
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_net_ntop()</TT >lwres_net_ntop()</TT
> > converts an IP address of
converts an IP address of protocol family protocol family <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>af</I >af</I
></TT ></TT
> > &mdash; IPv4 or IPv6 &mdash;
&mdash; IPv4 or IPv6 &mdash; at location <TT
at location
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>src</I >src</I
></TT ></TT
> > from network format to its
from network format to its conventional representation as a string. conventional representation as a string. For IPv4 addresses, that
For IPv4 addresses, that string would be a dotted-decimal. string would be a dotted-decimal. An IPv6 address would be
An IPv6 address would be represented in colon notation as described in represented in colon notation as described in RFC1884.</P
RFC1884.</P
><P ><P
>The generated string is copied to >The generated string is copied to <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>dst</I >dst</I
></TT ></TT
> > provided
provided
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>size</I >size</I
></TT ></TT
> > indicates it is long enough to store the
indicates it is long enough to store the ASCII representation ASCII representation of the address.</P
of the address.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
@@ -128,43 +121,35 @@ NAME="AEN30"
><H2 ><H2
>RETURN VALUES</H2 >RETURN VALUES</H2
><P ><P
>If successful, the function returns >If successful, the function returns <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>dst</I >dst</I
></TT ></TT
>: >:
a pointer to a string containing the presentation format of the
a pointer to a string containing address. <TT
the presentation format of the address.
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_net_ntop()</TT >lwres_net_ntop()</TT
> > returns
returns
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > and sets the global variable
and sets the global variable
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>errno</TT >errno</TT
> > to <SPAN
to
<SPAN
CLASS="ERRORCODE" CLASS="ERRORCODE"
>EAFNOSUPPORT</SPAN >EAFNOSUPPORT</SPAN
> > if
if the protocol family given in the protocol family given in <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>af</I >af</I
></TT ></TT
> > is not
is not supported.</P supported.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"

View File

@@ -93,58 +93,33 @@ Although the structures have different types, they are identical.
This is because the no-op opcode simply echos whatever data was sent: This is because the no-op opcode simply echos whatever data was sent:
the response is therefore identical to the request. the response is therefore identical to the request.
.PP .PP
\fBlwres_nooprequest_render()\fR \fBlwres_nooprequest_render()\fR uses resolver
uses resolver context context \fIctx\fR to convert no-op request structure
\fIctx\fR \fIreq\fR to canonical format. The packet header
to convert no-op request structure structure \fIpkt\fR is initialised and transferred to
\fIreq\fR buffer \fIb\fR. The contents of
to canonical format. \fI*req\fR are then appended to the buffer in
The packet header structure canonical format. \fBlwres_noopresponse_render()\fR
\fIpkt\fR
is initialised and transferred to
buffer
\fIb\fR.
The contents of
\fI*req\fR
are then appended to the buffer in canonical format.
\fBlwres_noopresponse_render()\fR
performs the same task, except it converts a no-op response structure performs the same task, except it converts a no-op response structure
\fBlwres_noopresponse_t\fR \fBlwres_noopresponse_t\fR to the lightweight resolver's
to the lightweight resolver's canonical format. canonical format.
.PP .PP
\fBlwres_nooprequest_parse()\fR \fBlwres_nooprequest_parse()\fR uses context
uses context \fIctx\fR to convert the contents of packet
\fIctx\fR \fIpkt\fR to a \fBlwres_nooprequest_t\fR
to convert the contents of packet structure. Buffer \fIb\fR provides space to be used
\fIpkt\fR for storing this structure. When the function succeeds, the resulting
to a \fBlwres_nooprequest_t\fR is made available through
\fBlwres_nooprequest_t\fR
structure.
Buffer
\fIb\fR
provides space to be used for storing this structure.
When the function succeeds, the resulting
\fBlwres_nooprequest_t\fR
is made available through
\fI*structp\fR. \fI*structp\fR.
\fBlwres_noopresponse_parse()\fR \fBlwres_noopresponse_parse()\fR offers the same
offers the same semantics as semantics as \fBlwres_nooprequest_parse()\fR except it
\fBlwres_nooprequest_parse()\fR yields a \fBlwres_noopresponse_t\fR structure.
except it yields a
\fBlwres_noopresponse_t\fR
structure.
.PP .PP
\fBlwres_noopresponse_free()\fR \fBlwres_noopresponse_free()\fR and
and \fBlwres_nooprequest_free()\fR release the memory in
\fBlwres_nooprequest_free()\fR resolver context \fIctx\fR that was allocated to the
release the memory in resolver context \fBlwres_noopresponse_t\fR or \fBlwres_nooprequest_t\fR
\fIctx\fR structures referenced via \fIstructp\fR.
that was allocated to the
\fBlwres_noopresponse_t\fR
or
\fBlwres_nooprequest_t\fR
structures referenced via
\fIstructp\fR.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
The no-op opcode functions The no-op opcode functions

View File

@@ -176,47 +176,38 @@ the response is therefore identical to the request.</P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_nooprequest_render()</TT >lwres_nooprequest_render()</TT
> > uses resolver
uses resolver context context <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>ctx</I >ctx</I
></TT ></TT
> > to convert no-op request structure
to convert no-op request structure
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>req</I >req</I
></TT ></TT
> > to canonical format. The packet header
to canonical format. structure <TT
The packet header structure
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>pkt</I >pkt</I
></TT ></TT
> > is initialised and transferred to
is initialised and transferred to buffer <TT
buffer
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
>. >. The contents of
The contents of
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*req</I >*req</I
></TT ></TT
> > are then appended to the buffer in
are then appended to the buffer in canonical format. canonical format. <TT
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_noopresponse_render()</TT >lwres_noopresponse_render()</TT
> >
@@ -224,103 +215,85 @@ performs the same task, except it converts a no-op response structure
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_noopresponse_t</SPAN >lwres_noopresponse_t</SPAN
> > to the lightweight resolver's
to the lightweight resolver's canonical format.</P canonical format.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_nooprequest_parse()</TT >lwres_nooprequest_parse()</TT
> > uses context
uses context
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>ctx</I >ctx</I
></TT ></TT
> > to convert the contents of packet
to convert the contents of packet
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>pkt</I >pkt</I
></TT ></TT
> > to a <SPAN
to a
<SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_nooprequest_t</SPAN >lwres_nooprequest_t</SPAN
> >
structure. structure. Buffer <TT
Buffer
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
> > provides space to be used
provides space to be used for storing this structure. for storing this structure. When the function succeeds, the resulting
When the function succeeds, the resulting
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_nooprequest_t</SPAN >lwres_nooprequest_t</SPAN
> > is made available through
is made available through
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*structp</I >*structp</I
></TT ></TT
>. >.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_noopresponse_parse()</TT >lwres_noopresponse_parse()</TT
> > offers the same
offers the same semantics as semantics as <TT
<TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_nooprequest_parse()</TT >lwres_nooprequest_parse()</TT
> > except it
except it yields a yields a <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_noopresponse_t</SPAN >lwres_noopresponse_t</SPAN
> > structure.</P
structure.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_noopresponse_free()</TT >lwres_noopresponse_free()</TT
> > and
and
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_nooprequest_free()</TT >lwres_nooprequest_free()</TT
> > release the memory in
release the memory in resolver context resolver context <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>ctx</I >ctx</I
></TT ></TT
> > that was allocated to the
that was allocated to the
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_noopresponse_t</SPAN >lwres_noopresponse_t</SPAN
> > or <SPAN
or
<SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_nooprequest_t</SPAN >lwres_nooprequest_t</SPAN
> >
structures referenced via structures referenced via <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>structp</I >structp</I
></TT ></TT
>.&#13;</P >.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"

View File

@@ -53,7 +53,6 @@ struct lwres_lwpacket {
.sp .sp
.fi .fi
.PP .PP
.PP
The elements of this structure are: The elements of this structure are:
.TP .TP
\fBlength\fR \fBlength\fR
@@ -127,41 +126,28 @@ The lwres_gabn_*() functions should be used for this type.
return the hostname for the given address. return the hostname for the given address.
The lwres_gnba_*() functions should be used for this type. The lwres_gnba_*() functions should be used for this type.
.PP .PP
\fBlwres_lwpacket_renderheader()\fR \fBlwres_lwpacket_renderheader()\fR transfers the
transfers the contents of lightweight resolver packet structure contents of lightweight resolver packet structure
\fBlwres_lwpacket_t\fR \fBlwres_lwpacket_t\fR \fI*pkt\fR in network
\fI*pkt\fR byte order to the lightweight resolver buffer,
in network byte order to the lightweight resolver buffer,
\fI*b\fR. \fI*b\fR.
.PP .PP
\fBlwres_lwpacket_parseheader()\fR \fBlwres_lwpacket_parseheader()\fR performs the
performs the converse operation. converse operation. It transfers data in network byte order from
It transfers data in network byte order from buffer buffer \fI*b\fR to resolver packet
\fI*b\fR \fI*pkt\fR. The contents of the buffer
to resolver packet \fIb\fR should correspond to a
\fI*pkt\fR.
The contents of the buffer
\fIb\fR
should correspond to a
\fBlwres_lwpacket_t\fR. \fBlwres_lwpacket_t\fR.
.PP .PP
Both functions have assertion checks to ensure that Both functions have assertion checks to ensure that
\fIb\fR \fIb\fR and \fIpkt\fR are not
and
\fIpkt\fR
are not
\fBNULL\fR. \fBNULL\fR.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
Successful calls to Successful calls to
\fBlwres_lwpacket_renderheader()\fR \fBlwres_lwpacket_renderheader()\fR and
and \fBlwres_lwpacket_parseheader()\fR return
\fBlwres_lwpacket_parseheader()\fR LWRES_R_SUCCESS. If there is insufficient
return space to copy data between the buffer \fI*b\fR and
LWRES_R_SUCCESS. lightweight resolver packet \fI*pkt\fR both functions
If there is insufficient space to copy data between the buffer return LWRES_R_UNEXPECTEDEND.
\fI*b\fR
and lightweight resolver packet
\fI*pkt\fR
both functions return
LWRES_R_UNEXPECTEDEND.

View File

@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--> -->
<!-- $Id: lwres_packet.docbook,v 1.5 2001/06/18 22:07:01 gson Exp $ --> <!-- $Id: lwres_packet.docbook,v 1.6 2001/06/18 22:56:30 gson Exp $ -->
<refentry> <refentry>
@@ -201,12 +201,6 @@ buffer <parameter>*b</parameter> to resolver packet
<type>lwres_lwpacket_t</type>. <type>lwres_lwpacket_t</type>.
</para> </para>
<para>
Both functions have assertion checks to ensure that
<parameter>b</parameter> and <parameter>pkt</parameter> are not
<type>NULL</type>.
</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@@ -115,8 +115,6 @@ struct lwres_lwpacket {
};</PRE };</PRE
></P ></P
><P ><P
></P
><P
>The elements of this structure are: >The elements of this structure are:
<P <P
></P ></P
@@ -285,58 +283,52 @@ The lwres_gnba_*() functions should be used for this type.</P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_lwpacket_renderheader()</TT >lwres_lwpacket_renderheader()</TT
> > transfers the
transfers the contents of lightweight resolver packet structure contents of lightweight resolver packet structure
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_lwpacket_t</SPAN >lwres_lwpacket_t</SPAN
> > <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*pkt</I >*pkt</I
></TT ></TT
> > in network
in network byte order to the lightweight resolver buffer, byte order to the lightweight resolver buffer,
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*b</I >*b</I
></TT ></TT
>.&#13;</P >.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_lwpacket_parseheader()</TT >lwres_lwpacket_parseheader()</TT
> > performs the
performs the converse operation. converse operation. It transfers data in network byte order from
It transfers data in network byte order from buffer buffer <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*b</I >*b</I
></TT ></TT
> > to resolver packet
to resolver packet
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*pkt</I >*pkt</I
></TT ></TT
>. >. The contents of the buffer
The contents of the buffer
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
> > should correspond to a
should correspond to a
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>lwres_lwpacket_t</SPAN >lwres_lwpacket_t</SPAN
>.&#13;</P >.</P
><P ><P
>Both functions have assertion checks to ensure that >Both functions have assertion checks to ensure that
<TT <TT
@@ -344,63 +336,54 @@ CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
> > and <TT
and
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>pkt</I >pkt</I
></TT ></TT
> > are not
are not
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
>.&#13;</P >.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
><A ><A
NAME="AEN112" NAME="AEN111"
></A ></A
><H2 ><H2
>RETURN VALUES</H2 >RETURN VALUES</H2
><P ><P
>Successful calls to > Successful calls to
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_lwpacket_renderheader()</TT >lwres_lwpacket_renderheader()</TT
> > and
and
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_lwpacket_parseheader()</TT >lwres_lwpacket_parseheader()</TT
> > return
return
<SPAN <SPAN
CLASS="ERRORCODE" CLASS="ERRORCODE"
>LWRES_R_SUCCESS</SPAN >LWRES_R_SUCCESS</SPAN
>. >. If there is insufficient
space to copy data between the buffer <TT
If there is insufficient space to copy data between the buffer
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*b</I >*b</I
></TT ></TT
> > and
and lightweight resolver packet lightweight resolver packet <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*pkt</I >*pkt</I
></TT ></TT
> > both functions
both functions return return <SPAN
<SPAN
CLASS="ERRORCODE" CLASS="ERRORCODE"
>LWRES_R_UNEXPECTEDEND</SPAN >LWRES_R_UNEXPECTEDEND</SPAN
>.&#13;</P >.</P
></DIV ></DIV
></BODY ></BODY
></HTML ></HTML

View File

@@ -41,44 +41,28 @@ lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_
.ad .ad
\fR.SH "DESCRIPTION" \fR.SH "DESCRIPTION"
.PP .PP
\fBlwres_string_parse()\fR \fBlwres_string_parse()\fR retrieves a DNS-encoded
retrieves a DNS-encoded string starting the current pointer of string starting the current pointer of lightweight resolver buffer
lightweight resolver buffer \fIb\fR: i.e. b->current.
\fIb\fR:
i.e.
b->current.
When the function returns, the address of the first byte of the When the function returns, the address of the first byte of the
encoded string is returned via encoded string is returned via \fI*c\fR and the
\fI*c\fR length of that string is given by \fI*len\fR. The
and the length of that string is given by buffer's current pointer is advanced to point at the character
\fI*len\fR.
The buffer's current pointer is advanced to point at the character
following the string length, the encoded string, and the trailing following the string length, the encoded string, and the trailing
\fBNULL\fR \fBNULL\fR character.
character. \fBlwres_string_parse()\fR has an assertion check that
\fBlwres_string_parse()\fR \fIb\fR is not \fBNULL\fR.
has an assertion check that
\fIb\fR
is not
\fBNULL\fR.
.PP .PP
\fBlwres_addr_parse()\fR \fBlwres_addr_parse()\fR extracts an address from the
extracts an address from the buffer buffer \fIb\fR. It checks that
\fIb\fR. \fIaddr\fR is not null. The buffer's current pointer
It checks that b->current is presumed to point at an encoded
\fIaddr\fR address: the address preceded by a 32-bit protocol family identifier
is not null. and a 16-bit length field. The encoded address is copied to
The buffer's current pointer addr->address and
b->current addr->length indicates the size in bytes of
is presumed to point at an encoded address: the address preceded by a the address that was copied. b->current is
32-bit protocol family identifier and a 16-bit length field. advanced to point at the next byte of available data in the buffer
The encoded address is copied to
addr->address
and
addr->length
indicates the size in bytes of the address that was copied.
b->current
is advanced to point at the next byte of available data in the buffer
following the encoded address. following the encoded address.
.PP .PP
\fBlwres_getaddrsbyname()\fR \fBlwres_getaddrsbyname()\fR
@@ -109,58 +93,32 @@ they are controlled through the
functions. functions.
.PP .PP
The lightweight resolver uses The lightweight resolver uses
\fBlwres_getaddrsbyname()\fR \fBlwres_getaddrsbyname()\fR to perform foward lookups.
to perform foward lookups. Hostname \fIname\fR is looked up using the resolver
Hostname context \fIctx\fR for memory allocation.
\fIname\fR \fIaddrtypes\fR is a bitmask indicating which type of
is looked up using the resolver context addresses are to be looked up. Current values for this bitmask are
\fIctx\fR \fBLWRES_ADDRTYPE_V4\fR for IPv4 addresses and
for memory allocation. \fBLWRES_ADDRTYPE_V6\fR for IPv6 addresses. Results of the
\fIaddrtypes\fR lookup are returned in \fI*structp\fR.
is a bitmask indicating which type of addresses are to be looked up. \fBlwres_getaddrsbyname()\fR checks that its pointer
Current values for this bitmask are arguments are not \fBNULL\fR and that
\fBLWRES_ADDRTYPE_V4\fR \fIaddrtypes\fR is non-zero.
for IPv4 addresses and
\fBLWRES_ADDRTYPE_V6\fR
for IPv6 addresses.
Results of the lookup are returned in
\fI*structp\fR.
\fBlwres_getaddrsbyname()\fR
checks that its pointer arguments are not
\fBNULL\fR
and that
\fIaddrtypes\fR
is non-zero.
.PP .PP
\fBlwres_getnamebyaddr()\fR \fBlwres_getnamebyaddr()\fR performs reverse lookups.
performs reverse lookups. Resolver context \fIctx\fR is used for memory
Resolver context allocation. The address type is indicated by
\fIctx\fR \fIaddrtype\fR: \fBLWRES_ADDRTYPE_V4\fR or
is used for memory allocation. \fBLWRES_ADDRTYPE_V6\fR. The address to be looked up is given
The address type is indicated by by \fIaddr\fR and its length is
\fIaddrtype\fR: \fIaddrlen\fR bytes. The result of the function call
\fBLWRES_ADDRTYPE_V4\fR is made available through \fI*structp\fR. Like
or
\fBLWRES_ADDRTYPE_V6\fR.
The address to be looked up is given by
\fIaddr\fR
and its length is
\fIaddrlen\fR
bytes.
The result of the function call is made available through
\fI*structp\fR.
Like
\fBlwres_getaddrsbyname()\fR, \fBlwres_getaddrsbyname()\fR,
\fBlwres_getnamebyaddr()\fR \fBlwres_getnamebyaddr()\fR uses assertion checking to
uses assertion checking to ensure its pointer arguments are not ensure its pointer arguments are not \fBNULL\fR and
\fBNULL\fR \fIaddrtype\fR is not zero.
and \fBlwres_getaddrsbyname()\fR also checks that
\fIaddrtype\fR \fIaddrlen\fR is non-zero.
is not zero.
\fBlwres_getaddrsbyname()\fR
also checks that
\fIaddrlen\fR
is non-zero.
.SH "RETURN VALUES" .SH "RETURN VALUES"
.PP .PP
Successful calls to Successful calls to

View File

@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--> -->
<!-- $Id: lwres_resutil.docbook,v 1.4 2001/06/18 22:07:02 gson Exp $ --> <!-- $Id: lwres_resutil.docbook,v 1.5 2001/06/18 22:56:34 gson Exp $ -->
<refentry> <refentry>
@@ -90,14 +90,11 @@ length of that string is given by <parameter>*len</parameter>. The
buffer's current pointer is advanced to point at the character buffer's current pointer is advanced to point at the character
following the string length, the encoded string, and the trailing following the string length, the encoded string, and the trailing
<type>NULL</type> character. <type>NULL</type> character.
<function>lwres_string_parse()</function> has an assertion check that
<parameter>b</parameter> is not <type>NULL</type>.
</para> </para>
<para> <para>
<function>lwres_addr_parse()</function> extracts an address from the <function>lwres_addr_parse()</function> extracts an address from the
buffer <parameter>b</parameter>. It checks that buffer <parameter>b</parameter>. The buffer's current pointer
<parameter>addr</parameter> is not null. The buffer's current pointer
<constant>b-&gt;current</constant> is presumed to point at an encoded <constant>b-&gt;current</constant> is presumed to point at an encoded
address: the address preceded by a 32-bit protocol family identifier address: the address preceded by a 32-bit protocol family identifier
and a 16-bit length field. The encoded address is copied to and a 16-bit length field. The encoded address is copied to
@@ -148,9 +145,9 @@ addresses are to be looked up. Current values for this bitmask are
<type>LWRES_ADDRTYPE_V4</type> for IPv4 addresses and <type>LWRES_ADDRTYPE_V4</type> for IPv4 addresses and
<type>LWRES_ADDRTYPE_V6</type> for IPv6 addresses. Results of the <type>LWRES_ADDRTYPE_V6</type> for IPv6 addresses. Results of the
lookup are returned in <parameter>*structp</parameter>. lookup are returned in <parameter>*structp</parameter>.
<function>lwres_getaddrsbyname()</function> checks that its pointer </para>
arguments are not <type>NULL</type> and that
<parameter>addrtypes</parameter> is non-zero. </para> <para> <para>
<function>lwres_getnamebyaddr()</function> performs reverse lookups. <function>lwres_getnamebyaddr()</function> performs reverse lookups.
Resolver context <parameter>ctx</parameter> is used for memory Resolver context <parameter>ctx</parameter> is used for memory
allocation. The address type is indicated by allocation. The address type is indicated by
@@ -158,13 +155,7 @@ allocation. The address type is indicated by
<type>LWRES_ADDRTYPE_V6</type>. The address to be looked up is given <type>LWRES_ADDRTYPE_V6</type>. The address to be looked up is given
by <parameter>addr</parameter> and its length is by <parameter>addr</parameter> and its length is
<parameter>addrlen</parameter> bytes. The result of the function call <parameter>addrlen</parameter> bytes. The result of the function call
is made available through <parameter>*structp</parameter>. Like is made available through <parameter>*structp</parameter>.
<function>lwres_getaddrsbyname()</function>,
<function>lwres_getnamebyaddr()</function> uses assertion checking to
ensure its pointer arguments are not <type>NULL</type> and
<parameter>addrtype</parameter> is not zero.
<function>lwres_getaddrsbyname()</function> also checks that
<parameter>addrlen</parameter> is non-zero.
</para> </para>
</refsect1> </refsect1>

View File

@@ -106,105 +106,85 @@ NAME="AEN43"
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_string_parse()</TT >lwres_string_parse()</TT
> > retrieves a DNS-encoded
retrieves a DNS-encoded string starting the current pointer of string starting the current pointer of lightweight resolver buffer
lightweight resolver buffer
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
>: >: i.e. <TT
i.e.
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>b-&gt;current</TT >b-&gt;current</TT
>. >.
When the function returns, the address of the first byte of the When the function returns, the address of the first byte of the
encoded string is returned via encoded string is returned via <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*c</I >*c</I
></TT ></TT
> > and the
and the length of that string is given by length of that string is given by <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*len</I >*len</I
></TT ></TT
>. >. The
buffer's current pointer is advanced to point at the character
The buffer's current pointer is advanced to point at the character
following the string length, the encoded string, and the trailing following the string length, the encoded string, and the trailing
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > character.
character.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_string_parse()</TT >lwres_string_parse()</TT
> > has an assertion check that
has an assertion check that
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
> > is not <SPAN
is not
<SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
>.&#13;</P >.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_addr_parse()</TT >lwres_addr_parse()</TT
> > extracts an address from the
extracts an address from the buffer buffer <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>b</I >b</I
></TT ></TT
>. >. It checks that
It checks that
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addr</I >addr</I
></TT ></TT
> > is not null. The buffer's current pointer
is not null.
The buffer's current pointer
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>b-&gt;current</TT >b-&gt;current</TT
> > is presumed to point at an encoded
is presumed to point at an encoded address: the address preceded by a address: the address preceded by a 32-bit protocol family identifier
32-bit protocol family identifier and a 16-bit length field. and a 16-bit length field. The encoded address is copied to
The encoded address is copied to
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>addr-&gt;address</TT >addr-&gt;address</TT
> > and
and
<TT <TT
CLASS="CONSTANT" CLASS="CONSTANT"
>addr-&gt;length</TT >addr-&gt;length</TT
> > indicates the size in bytes of
indicates the size in bytes of the address that was copied. the address that was copied. <TT
<TT
CLASS="CONSTANT" CLASS="CONSTANT"
>b-&gt;current</TT >b-&gt;current</TT
> > is
is advanced to point at the next byte of available data in the buffer advanced to point at the next byte of available data in the buffer
following the encoded address.</P following the encoded address.</P
><P ><P
><TT ><TT
@@ -252,156 +232,125 @@ functions.</P
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT >lwres_getaddrsbyname()</TT
> > to perform foward lookups.
to perform foward lookups. Hostname <TT
Hostname
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>name</I >name</I
></TT ></TT
> > is looked up using the resolver
is looked up using the resolver context context <TT
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>ctx</I >ctx</I
></TT ></TT
> > for memory allocation.
for memory allocation.
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrtypes</I >addrtypes</I
></TT ></TT
> > is a bitmask indicating which type of
is a bitmask indicating which type of addresses are to be looked up. addresses are to be looked up. Current values for this bitmask are
Current values for this bitmask are
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>LWRES_ADDRTYPE_V4</SPAN >LWRES_ADDRTYPE_V4</SPAN
> > for IPv4 addresses and
for IPv4 addresses and
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>LWRES_ADDRTYPE_V6</SPAN >LWRES_ADDRTYPE_V6</SPAN
> > for IPv6 addresses. Results of the
for IPv6 addresses. lookup are returned in <TT
Results of the lookup are returned in
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*structp</I >*structp</I
></TT ></TT
>. >.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT >lwres_getaddrsbyname()</TT
> > checks that its pointer
checks that its pointer arguments are not arguments are not <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > and that
and that
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrtypes</I >addrtypes</I
></TT ></TT
> > is non-zero. </P
is non-zero.</P
><P ><P
><TT ><TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT >lwres_getnamebyaddr()</TT
> > performs reverse lookups.
performs reverse lookups. Resolver context <TT
Resolver context
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>ctx</I >ctx</I
></TT ></TT
> > is used for memory
is used for memory allocation. allocation. The address type is indicated by
The address type is indicated by
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrtype</I >addrtype</I
></TT ></TT
>: >: <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>LWRES_ADDRTYPE_V4</SPAN >LWRES_ADDRTYPE_V4</SPAN
> > or
or
<SPAN <SPAN
CLASS="TYPE" CLASS="TYPE"
>LWRES_ADDRTYPE_V6</SPAN >LWRES_ADDRTYPE_V6</SPAN
>. >. The address to be looked up is given
by <TT
The address to be looked up is given by
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addr</I >addr</I
></TT ></TT
> > and its length is
and its length is
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrlen</I >addrlen</I
></TT ></TT
> > bytes. The result of the function call
bytes. is made available through <TT
The result of the function call is made available through
<TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>*structp</I >*structp</I
></TT ></TT
>. >. Like
Like
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT >lwres_getaddrsbyname()</TT
>, >,
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT >lwres_getnamebyaddr()</TT
> > uses assertion checking to
uses assertion checking to ensure its pointer arguments are not ensure its pointer arguments are not <SPAN
<SPAN
CLASS="TYPE" CLASS="TYPE"
>NULL</SPAN >NULL</SPAN
> > and
and
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrtype</I >addrtype</I
></TT ></TT
> > is not zero.
is not zero.
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT >lwres_getaddrsbyname()</TT
> > also checks that
also checks that
<TT <TT
CLASS="PARAMETER" CLASS="PARAMETER"
><I ><I
>addrlen</I >addrlen</I
></TT ></TT
> > is non-zero.</P
is non-zero.</P
></DIV ></DIV
><DIV ><DIV
CLASS="REFSECT1" CLASS="REFSECT1"
@@ -470,7 +419,7 @@ is returned by a successful call to
<TT <TT
CLASS="FUNCTION" CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT >lwres_getnamebyaddr()</TT
>.&#13;</P >.</P
><P ><P
>Both >Both
<TT <TT