Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > d15970ce597ed0612e4ce6355c1aa32c > files > 142

bind-9.3.1-4.3.20060mdk.x86_64.rpm

<!--
 - 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_packet.html,v 1.8.2.1.4.2 2004/08/22 23:39:05 marka Exp $ -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>lwres_packet</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><H1
><A
NAME="AEN1"
></A
>lwres_packet</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8"
></A
><H2
>Name</H2
>lwres_lwpacket_renderheader, lwres_lwpacket_parseheader&nbsp;--&nbsp;lightweight resolver packet handling functions</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN12"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><P
></P
><A
NAME="AEN13"
></A
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include &lt;lwres/lwpacket.h&gt;</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>lwres_result_t
lwres_lwpacket_renderheader</CODE
>(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</CODE
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>lwres_result_t
lwres_lwpacket_parseheader</CODE
>(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN25"
></A
><H2
>DESCRIPTION</H2
><P
>These functions rely on a
<SPAN
CLASS="TYPE"
>struct lwres_lwpacket</SPAN
>
which is defined in
<TT
CLASS="FILENAME"
>lwres/lwpacket.h</TT
>.

<PRE
CLASS="PROGRAMLISTING"
>typedef struct lwres_lwpacket lwres_lwpacket_t;

struct lwres_lwpacket {
        lwres_uint32_t          length;
        lwres_uint16_t          version;
        lwres_uint16_t          pktflags;
        lwres_uint32_t          serial;
        lwres_uint32_t          opcode;
        lwres_uint32_t          result;
        lwres_uint32_t          recvlength;
        lwres_uint16_t          authtype;
        lwres_uint16_t          authlength;
};</PRE
></P
><P
>The elements of this structure are:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><CODE
CLASS="CONSTANT"
>length</CODE
></DT
><DD
><P
>the overall packet length, including the entire packet header.
This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
calls.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>version</CODE
></DT
><DD
><P
>the header format. There is currently only one format,
<SPAN
CLASS="TYPE"
>LWRES_LWPACKETVERSION_0</SPAN
>.

This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
calls.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>pktflags</CODE
></DT
><DD
><P
>library-defined flags for this packet: for instance whether the packet
is a request or a reply. Flag values can be set, but not defined by
the caller.
This field is filled in by the application wit the exception of the
LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
lwres_gabn_*() and lwres_gnba_*() calls.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>serial</CODE
></DT
><DD
><P
>is set by the requestor and is returned in all replies. If two or more
packets from the same source have the same serial number and are from
the same source, they are assumed to be duplicates and the latter ones
may be dropped.
This field must be set by the application.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>opcode</CODE
></DT
><DD
><P
>indicates the operation.
Opcodes between 0x00000000 and 0x03ffffff are
reserved for use by the lightweight resolver library. Opcodes between
0x04000000 and 0xffffffff are application defined.
This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
calls.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>result</CODE
></DT
><DD
><P
>is only valid for replies.
Results between 0x04000000 and 0xffffffff are application defined.
Results between 0x00000000 and 0x03ffffff are reserved for library use.
This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
calls.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>recvlength</CODE
></DT
><DD
><P
>is the maximum buffer size that the receiver can handle on requests
and the size of the buffer needed to satisfy a request when the buffer
is too large for replies.
This field is supplied by the application.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>authtype</CODE
></DT
><DD
><P
>defines the packet level authentication that is used.
Authorisation types between 0x1000 and 0xffff are application defined
and types between 0x0000 and 0x0fff are reserved for library use.
Currently these are not used and must be zero.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>authlen</CODE
></DT
><DD
><P
>gives the length of the authentication data.
Since packet authentication is currently not used, this must be zero.</P
></DD
></DL
></DIV
></P
><P
>The following opcodes are currently defined:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><CODE
CLASS="CONSTANT"
>NOOP</CODE
></DT
><DD
><P
>Success is always returned and the packet contents are echoed.
The lwres_noop_*() functions should be used for this type.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>GETADDRSBYNAME</CODE
></DT
><DD
><P
>returns all known addresses for a given name.
The lwres_gabn_*() functions should be used for this type.</P
></DD
><DT
><CODE
CLASS="CONSTANT"
>GETNAMEBYADDR</CODE
></DT
><DD
><P
>return the hostname for the given address.
The lwres_gnba_*() functions should be used for this type.</P
></DD
></DL
></DIV
></P
><P
><CODE
CLASS="FUNCTION"
>lwres_lwpacket_renderheader()</CODE
> transfers the
contents of lightweight resolver packet structure
<SPAN
CLASS="TYPE"
>lwres_lwpacket_t</SPAN
> <VAR
CLASS="PARAMETER"
>*pkt</VAR
> in network
byte order to the lightweight resolver buffer,
<VAR
CLASS="PARAMETER"
>*b</VAR
>.</P
><P
><CODE
CLASS="FUNCTION"
>lwres_lwpacket_parseheader()</CODE
> performs the
converse operation.  It transfers data in network byte order from
buffer <VAR
CLASS="PARAMETER"
>*b</VAR
> to resolver packet
<VAR
CLASS="PARAMETER"
>*pkt</VAR
>.  The contents of the buffer
<VAR
CLASS="PARAMETER"
>b</VAR
> should correspond to a
<SPAN
CLASS="TYPE"
>lwres_lwpacket_t</SPAN
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN107"
></A
><H2
>RETURN VALUES</H2
><P
> Successful calls to
<CODE
CLASS="FUNCTION"
>lwres_lwpacket_renderheader()</CODE
> and
<CODE
CLASS="FUNCTION"
>lwres_lwpacket_parseheader()</CODE
> return
<SPAN
CLASS="ERRORCODE"
>LWRES_R_SUCCESS</SPAN
>.  If there is insufficient
space to copy data between the buffer <VAR
CLASS="PARAMETER"
>*b</VAR
> and
lightweight resolver packet <VAR
CLASS="PARAMETER"
>*pkt</VAR
> both functions
return <SPAN
CLASS="ERRORCODE"
>LWRES_R_UNEXPECTEDEND</SPAN
>.</P
></DIV
></BODY
></HTML
>