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