235N/A - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 822N/A - Copyright (C) 2001 Internet Software Consortium. 822N/A - Permission to use, copy, modify, and distribute this software for any 235N/A - purpose with or without fee is hereby granted, provided that the above 935N/A - copyright notice and this permission notice appear in all copies. 235N/A - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 919N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 919N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 919N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 919N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 919N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 919N/A - PERFORMANCE OF THIS SOFTWARE. 919N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
235N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.7"></
HEAD 822N/A>lwres_lwpacket_renderheader, lwres_lwpacket_parseheader -- lightweight resolver packet handling functions</
DIV 822N/ACLASS="FUNCSYNOPSISINFO" 947N/Alwres_lwpacket_renderheader</
CODE 235N/A>(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</
CODE 947N/Alwres_lwpacket_parseheader</
CODE 947N/A>(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</
CODE 493N/A>These functions rely on a
493N/A>struct lwres_lwpacket</
SPAN 235N/A>typedef struct lwres_lwpacket lwres_lwpacket_t;
916N/A lwres_uint16_t version;
916N/A lwres_uint16_t pktflags;
963N/A lwres_uint32_t recvlength;
963N/A lwres_uint16_t authtype;
963N/A lwres_uint16_t authlength;
235N/A>The elements of this structure are:
963N/A>the overall packet length, including the entire packet header.
963N/AThis field is filled in by the lwres_gabn_*() and lwres_gnba_*()
935N/A>the header format. There is currently only one format,
963N/A>LWRES_LWPACKETVERSION_0</
SPAN 963N/AThis field is filled in by the lwres_gabn_*() and lwres_gnba_*()
822N/A>library-defined flags for this packet: for instance whether the packet
606N/Ais a request or a reply. Flag values can be set, but not defined by
822N/AThis field is filled in by the application wit the exception of the
822N/ALWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
235N/Alwres_gabn_*() and lwres_gnba_*() calls.</
P 235N/A>is set by the requestor and is returned in all replies. If two or more
493N/Apackets from the same source have the same serial number and are from
493N/Athe same source, they are assumed to be duplicates and the latter ones
235N/AThis field must be set by the application.</
P 493N/A>indicates the operation.
235N/AOpcodes between 0x00000000 and 0x03ffffff are
606N/Areserved for use by the lightweight resolver library. Opcodes between
606N/A0x04000000 and 0xffffffff are application defined.
606N/AThis field is filled in by the lwres_gabn_*() and lwres_gnba_*()
235N/A>is only valid for replies.
822N/AResults between 0x04000000 and 0xffffffff are application defined.
235N/AResults between 0x00000000 and 0x03ffffff are reserved for library use.
922N/AThis field is filled in by the lwres_gabn_*() and lwres_gnba_*()
235N/A>is the maximum buffer size that the receiver can handle on requests
822N/Aand the size of the buffer needed to satisfy a request when the buffer
235N/Ais too large for replies.
606N/AThis field is supplied by the application.</
P 235N/A>defines the packet level authentication that is used.
247N/AAuthorisation types between 0x1000 and 0xffff are application defined
822N/Aand types between 0x0000 and 0x0fff are reserved for library use.
247N/ACurrently these are not used and must be zero.</
P 963N/A>gives the length of the authentication data.
963N/ASince packet authentication is currently not used, this must be zero.</
P 822N/A>The following opcodes are currently defined:
822N/A>Success is always returned and the packet contents are echoed.
822N/AThe lwres_noop_*() functions should be used for this type.</
P 822N/A>returns all known addresses for a given name.
822N/AThe lwres_gabn_*() functions should be used for this type.</
P >return the hostname for the given address.
The lwres_gnba_*() functions should be used for this type.</
P>lwres_lwpacket_renderheader()</
CODEcontents of lightweight resolver packet structure
byte order to the lightweight resolver buffer,
>lwres_lwpacket_parseheader()</
CODEconverse operation. It transfers data in network byte order from
>. The contents of the buffer
>lwres_lwpacket_renderheader()</
CODE>lwres_lwpacket_parseheader()</
CODE>. If there is insufficient
space to copy data between the buffer <
VARlightweight resolver packet <
VAR>LWRES_R_UNEXPECTEDEND</
SPAN