lwres_packet.docbook revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
f743002678eb67b99bbc29fee116b65d9530fec0wrowe<!--
80833bb9a1bf25dcf19e814438a4b311d2e1f4cffuankg - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
6736c640e65e06990ef33af71ee81fac4df4ff5fjim -
fc1459657a1fde206a847f9028930725d715f8b4trawick - This Source Code Form is subject to the terms of the Mozilla Public
fc1459657a1fde206a847f9028930725d715f8b4trawick - License, v. 2.0. If a copy of the MPL was not distributed with this
fc1459657a1fde206a847f9028930725d715f8b4trawick - file, You can obtain one at http://mozilla.org/MPL/2.0/.
e758971371df73b097609b2fd62bc14ad935e096trawick-->
e758971371df73b097609b2fd62bc14ad935e096trawick
e758971371df73b097609b2fd62bc14ad935e096trawick<!-- Converted by db4-upgrade version 1.0 -->
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf<refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf <info>
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf <date>2007-06-18</date>
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf </info>
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf <refentryinfo>
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf <corpname>ISC</corpname>
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf </refentryinfo>
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf <refmeta>
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf <refentrytitle>lwres_packet</refentrytitle>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand <manvolnum>3</manvolnum>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand <refmiscinfo>BIND9</refmiscinfo>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand </refmeta>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand
85eacfc96a04547ef25aabbc06440039715084c2jorton <docinfo>
85eacfc96a04547ef25aabbc06440039715084c2jorton <copyright>
85eacfc96a04547ef25aabbc06440039715084c2jorton <year>2004</year>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <year>2005</year>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <year>2007</year>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <year>2014</year>
f34da68471f256dca0ff770257c3e1f982f74cf1trawick <year>2015</year>
f34da68471f256dca0ff770257c3e1f982f74cf1trawick <year>2016</year>
f34da68471f256dca0ff770257c3e1f982f74cf1trawick <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
8b645fd3c950da73513b546366c7cfa7476c5c06jim </copyright>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <copyright>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <year>2000</year>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <year>2001</year>
193f0bb6057d67593ed652fbf58f043def51c642jim <holder>Internet Software Consortium.</holder>
193f0bb6057d67593ed652fbf58f043def51c642jim </copyright>
193f0bb6057d67593ed652fbf58f043def51c642jim </docinfo>
68ba377fc3b124baa759662077c48077ebadb186minfrin
68ba377fc3b124baa759662077c48077ebadb186minfrin <refnamediv>
68ba377fc3b124baa759662077c48077ebadb186minfrin <refname>lwres_lwpacket_renderheader</refname>
68ba377fc3b124baa759662077c48077ebadb186minfrin <refname>lwres_lwpacket_parseheader</refname>
00566fb187849626180724394a21ddcd28419fb2minfrin <refpurpose>lightweight resolver packet handling functions</refpurpose>
00566fb187849626180724394a21ddcd28419fb2minfrin </refnamediv>
00566fb187849626180724394a21ddcd28419fb2minfrin <refsynopsisdiv>
00566fb187849626180724394a21ddcd28419fb2minfrin <funcsynopsis>
d776b0a2d2889ce1d13494873368f34327a2e1bbtrawick<funcsynopsisinfo>#include &lt;lwres/lwpacket.h&gt;</funcsynopsisinfo>
d776b0a2d2889ce1d13494873368f34327a2e1bbtrawick<funcprototype>
f4ca9f6f002fece336168a16355434ca966f96a9trawick <funcdef>
57db302f0875a6c93a79333b8941cea4c1827272jimlwres_result_t
57db302f0875a6c93a79333b8941cea4c1827272jim<function>lwres_lwpacket_renderheader</function></funcdef>
57db302f0875a6c93a79333b8941cea4c1827272jim <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
57db302f0875a6c93a79333b8941cea4c1827272jim <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim </funcprototype>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim<funcprototype>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim <funcdef>
89225e8e84d38b07a8335922497997e83d872e75jimlwres_result_t
89225e8e84d38b07a8335922497997e83d872e75jim<function>lwres_lwpacket_parseheader</function></funcdef>
89225e8e84d38b07a8335922497997e83d872e75jim <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh </funcprototype>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh</funcsynopsis>
f5e28c78424d2f71c61ba457009f100bba38bc68chrisd </refsynopsisdiv>
f5e28c78424d2f71c61ba457009f100bba38bc68chrisd <refsection><info><title>DESCRIPTION</title></info>
f5e28c78424d2f71c61ba457009f100bba38bc68chrisd
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton <para>
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton These functions rely on a
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton <type>struct lwres_lwpacket</type>
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick which is defined in
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick <filename>lwres/lwpacket.h</filename>.
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick </para>
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jorton <para><programlisting>
985a4368b93c3e9171a57897ad9454c8dbf4cdf6jortontypedef struct lwres_lwpacket lwres_lwpacket_t;
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jorton </programlisting>
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jorton </para>
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedooh <para><programlisting>
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedoohstruct lwres_lwpacket {
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedooh lwres_uint32_t length;
4be250c774bdac977eef29a02183ca78de29fb41rjung lwres_uint16_t version;
4be250c774bdac977eef29a02183ca78de29fb41rjung lwres_uint16_t pktflags;
4be250c774bdac977eef29a02183ca78de29fb41rjung lwres_uint32_t serial;
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung lwres_uint32_t opcode;
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung lwres_uint32_t result;
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung lwres_uint32_t recvlength;
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung lwres_uint16_t authtype;
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh lwres_uint16_t authlength;
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh};
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh</programlisting>
10961a2f60207cb873d889bb28b1f0ef707a4311humbedooh </para>
10961a2f60207cb873d889bb28b1f0ef707a4311humbedooh
10961a2f60207cb873d889bb28b1f0ef707a4311humbedooh <para>
0448378b899e8df0c060360f17c0af692adf17bchumbedooh The elements of this structure are:
0448378b899e8df0c060360f17c0af692adf17bchumbedooh <variablelist>
0448378b899e8df0c060360f17c0af692adf17bchumbedooh <varlistentry>
60a765cccbd3f3b5997b65b0034220c79f78369etrawick <term><constant>length</constant></term>
60a765cccbd3f3b5997b65b0034220c79f78369etrawick <listitem>
60a765cccbd3f3b5997b65b0034220c79f78369etrawick <para>
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh the overall packet length, including the entire packet header.
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh calls.
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh </para>
91654e263480f0fdc2a03d782ff23f8dad07cf79humbedooh </listitem>
91814c869ca39ce45dfe147307d2a831cac6ecbehumbedooh </varlistentry>
91654e263480f0fdc2a03d782ff23f8dad07cf79humbedooh <varlistentry>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <term><constant>version</constant></term>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <listitem>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <para>
79c5787b92ac5f0e1cc82393816c77a006399316trawick the header format. There is currently only one format,
79c5787b92ac5f0e1cc82393816c77a006399316trawick <type>LWRES_LWPACKETVERSION_0</type>.
79c5787b92ac5f0e1cc82393816c77a006399316trawick
79c5787b92ac5f0e1cc82393816c77a006399316trawick This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
79c5787b92ac5f0e1cc82393816c77a006399316trawick calls.
79c5787b92ac5f0e1cc82393816c77a006399316trawick </para>
12b987b969f03ef98d9175a53d849ab62f5684fecovener </listitem>
12b987b969f03ef98d9175a53d849ab62f5684fecovener </varlistentry>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <varlistentry>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <term><constant>pktflags</constant></term>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <listitem>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <para>
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf library-defined flags for this packet: for instance whether the
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf packet
4bb0a88a01fb7b494bb02a8b881b5eab0308bda6sf is a request or a reply. Flag values can be set, but not defined
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf by
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton the caller.
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton This field is filled in by the application wit the exception of
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton the
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in
536e48c08d674acac5d44929318f2ad928edc361jorton the
536e48c08d674acac5d44929318f2ad928edc361jorton lwres_gabn_*() and lwres_gnba_*() calls.
e81785da447b469da66f218b3f0244aab507958djorton </para>
e81785da447b469da66f218b3f0244aab507958djorton </listitem>
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jorton </varlistentry>
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jorton <varlistentry>
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jorton <term><constant>serial</constant></term>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf <listitem>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf <para>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf is set by the requestor and is returned in all replies. If two
459eaf0826f995b73a0dc066f59ea10d2824e72dsf or more
53e9b27aba029b18be814df40bcf6f0428771d1efuankg packets from the same source have the same serial number and are
53e9b27aba029b18be814df40bcf6f0428771d1efuankg from
53e9b27aba029b18be814df40bcf6f0428771d1efuankg the same source, they are assumed to be duplicates and the
53e9b27aba029b18be814df40bcf6f0428771d1efuankg latter ones
53e9b27aba029b18be814df40bcf6f0428771d1efuankg may be dropped.
6bb524f1895f30265a1431afc460977d391cb36bsf This field must be set by the application.
6bb524f1895f30265a1431afc460977d391cb36bsf </para>
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf </listitem>
6bb524f1895f30265a1431afc460977d391cb36bsf </varlistentry>
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin <varlistentry>
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin <term><constant>opcode</constant></term>
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin <listitem>
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin <para>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin indicates the operation.
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin Opcodes between 0x00000000 and 0x03ffffff are
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin reserved for use by the lightweight resolver library. Opcodes
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin between
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung 0x04000000 and 0xffffffff are application defined.
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung calls.
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung </para>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung </listitem>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung </varlistentry>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung <varlistentry>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung <term><constant>result</constant></term>
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick <listitem>
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick <para>
0827cb14e550f6f65018431c22c2c913631c8f25kbrand is only valid for replies.
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick Results between 0x04000000 and 0xffffffff are application
ae600ca541efc686b34f8b1f21bd3d0741d37674covener defined.
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick Results between 0x00000000 and 0x03ffffff are reserved for
cfa64348224b66dd1c9979b809406c4d15b1c137fielding library use.
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
cfa64348224b66dd1c9979b809406c4d15b1c137fielding calls.
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim </para>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding </listitem>
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim </varlistentry>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding <varlistentry>
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim <term><constant>recvlength</constant></term>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding <listitem>
<para>
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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>authtype</constant></term>
<listitem>
<para>
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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>authlen</constant></term>
<listitem>
<para>
gives the length of the authentication data.
Since packet authentication is currently not used, this must be
zero.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The following opcodes are currently defined:
<variablelist>
<varlistentry>
<term><constant>NOOP</constant></term>
<listitem>
<para>
Success is always returned and the packet contents are echoed.
The lwres_noop_*() functions should be used for this type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GETADDRSBYNAME</constant></term>
<listitem>
<para>
returns all known addresses for a given name.
The lwres_gabn_*() functions should be used for this type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GETNAMEBYADDR</constant></term>
<listitem>
<para>
return the hostname for the given address.
The lwres_gnba_*() functions should be used for this type.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para><function>lwres_lwpacket_renderheader()</function>
transfers the contents of lightweight resolver packet structure
<type>lwres_lwpacket_t</type> <parameter>*pkt</parameter> in
network byte order to the lightweight resolver buffer,
<parameter>*b</parameter>.
</para>
<para><function>lwres_lwpacket_parseheader()</function>
performs the converse operation. It transfers data in network
byte order from buffer <parameter>*b</parameter> to resolver
packet <parameter>*pkt</parameter>. The contents of the buffer
<parameter>b</parameter> should correspond to a
<type>lwres_lwpacket_t</type>.
</para>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para>
Successful calls to
<function>lwres_lwpacket_renderheader()</function> and
<function>lwres_lwpacket_parseheader()</function> return
<errorcode>LWRES_R_SUCCESS</errorcode>. If there is insufficient
space to copy data between the buffer <parameter>*b</parameter> and
lightweight resolver packet <parameter>*pkt</parameter> both
functions
return <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>.
</para>
</refsection>
</refentry>