/contrib/bind9/lib/lwres/man/lwres_packet.docbook

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 292 lines · 279 code · 13 blank · 0 comment · 0 complexity · 5557aa23971d80f8f6878268605c8977 MD5 · raw file

  1. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY mdash "&#8212;">]>
  4. <!--
  5. - Copyright (C) 2004, 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC")
  6. - Copyright (C) 2000, 2001 Internet Software Consortium.
  7. -
  8. - Permission to use, copy, modify, and/or distribute this software for any
  9. - purpose with or without fee is hereby granted, provided that the above
  10. - copyright notice and this permission notice appear in all copies.
  11. -
  12. - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  13. - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14. - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  15. - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  16. - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  17. - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18. - PERFORMANCE OF THIS SOFTWARE.
  19. -->
  20. <!-- $Id$ -->
  21. <refentry>
  22. <refentryinfo>
  23. <date>Jun 30, 2000</date>
  24. </refentryinfo>
  25. <refmeta>
  26. <refentrytitle>lwres_packet</refentrytitle>
  27. <manvolnum>3</manvolnum>
  28. <refmiscinfo>BIND9</refmiscinfo>
  29. </refmeta>
  30. <docinfo>
  31. <copyright>
  32. <year>2004</year>
  33. <year>2005</year>
  34. <year>2007</year>
  35. <year>2012</year>
  36. <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
  37. </copyright>
  38. <copyright>
  39. <year>2000</year>
  40. <year>2001</year>
  41. <holder>Internet Software Consortium.</holder>
  42. </copyright>
  43. </docinfo>
  44. <refnamediv>
  45. <refname>lwres_lwpacket_renderheader</refname>
  46. <refname>lwres_lwpacket_parseheader</refname>
  47. <refpurpose>lightweight resolver packet handling functions</refpurpose>
  48. </refnamediv>
  49. <refsynopsisdiv>
  50. <funcsynopsis>
  51. <funcsynopsisinfo>#include &lt;lwres/lwpacket.h&gt;</funcsynopsisinfo>
  52. <funcprototype>
  53. <funcdef>
  54. lwres_result_t
  55. <function>lwres_lwpacket_renderheader</function></funcdef>
  56. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  57. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  58. </funcprototype>
  59. <funcprototype>
  60. <funcdef>
  61. lwres_result_t
  62. <function>lwres_lwpacket_parseheader</function></funcdef>
  63. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  64. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  65. </funcprototype>
  66. </funcsynopsis>
  67. </refsynopsisdiv>
  68. <refsect1>
  69. <title>DESCRIPTION</title>
  70. <para>
  71. These functions rely on a
  72. <type>struct lwres_lwpacket</type>
  73. which is defined in
  74. <filename>lwres/lwpacket.h</filename>.
  75. </para>
  76. <para><programlisting>
  77. typedef struct lwres_lwpacket lwres_lwpacket_t;
  78. </programlisting>
  79. </para>
  80. <para><programlisting>
  81. struct lwres_lwpacket {
  82. lwres_uint32_t length;
  83. lwres_uint16_t version;
  84. lwres_uint16_t pktflags;
  85. lwres_uint32_t serial;
  86. lwres_uint32_t opcode;
  87. lwres_uint32_t result;
  88. lwres_uint32_t recvlength;
  89. lwres_uint16_t authtype;
  90. lwres_uint16_t authlength;
  91. };
  92. </programlisting>
  93. </para>
  94. <para>
  95. The elements of this structure are:
  96. <variablelist>
  97. <varlistentry>
  98. <term><constant>length</constant></term>
  99. <listitem>
  100. <para>
  101. the overall packet length, including the entire packet header.
  102. This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
  103. calls.
  104. </para>
  105. </listitem>
  106. </varlistentry>
  107. <varlistentry>
  108. <term><constant>version</constant></term>
  109. <listitem>
  110. <para>
  111. the header format. There is currently only one format,
  112. <type>LWRES_LWPACKETVERSION_0</type>.
  113. This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
  114. calls.
  115. </para>
  116. </listitem>
  117. </varlistentry>
  118. <varlistentry>
  119. <term><constant>pktflags</constant></term>
  120. <listitem>
  121. <para>
  122. library-defined flags for this packet: for instance whether the
  123. packet
  124. is a request or a reply. Flag values can be set, but not defined
  125. by
  126. the caller.
  127. This field is filled in by the application wit the exception of
  128. the
  129. LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in
  130. the
  131. lwres_gabn_*() and lwres_gnba_*() calls.
  132. </para>
  133. </listitem>
  134. </varlistentry>
  135. <varlistentry>
  136. <term><constant>serial</constant></term>
  137. <listitem>
  138. <para>
  139. is set by the requestor and is returned in all replies. If two
  140. or more
  141. packets from the same source have the same serial number and are
  142. from
  143. the same source, they are assumed to be duplicates and the
  144. latter ones
  145. may be dropped.
  146. This field must be set by the application.
  147. </para>
  148. </listitem>
  149. </varlistentry>
  150. <varlistentry>
  151. <term><constant>opcode</constant></term>
  152. <listitem>
  153. <para>
  154. indicates the operation.
  155. Opcodes between 0x00000000 and 0x03ffffff are
  156. reserved for use by the lightweight resolver library. Opcodes
  157. between
  158. 0x04000000 and 0xffffffff are application defined.
  159. This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
  160. calls.
  161. </para>
  162. </listitem>
  163. </varlistentry>
  164. <varlistentry>
  165. <term><constant>result</constant></term>
  166. <listitem>
  167. <para>
  168. is only valid for replies.
  169. Results between 0x04000000 and 0xffffffff are application
  170. defined.
  171. Results between 0x00000000 and 0x03ffffff are reserved for
  172. library use.
  173. This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
  174. calls.
  175. </para>
  176. </listitem>
  177. </varlistentry>
  178. <varlistentry>
  179. <term><constant>recvlength</constant></term>
  180. <listitem>
  181. <para>
  182. is the maximum buffer size that the receiver can handle on
  183. requests
  184. and the size of the buffer needed to satisfy a request when the
  185. buffer
  186. is too large for replies.
  187. This field is supplied by the application.
  188. </para>
  189. </listitem>
  190. </varlistentry>
  191. <varlistentry>
  192. <term><constant>authtype</constant></term>
  193. <listitem>
  194. <para>
  195. defines the packet level authentication that is used.
  196. Authorisation types between 0x1000 and 0xffff are application
  197. defined
  198. and types between 0x0000 and 0x0fff are reserved for library
  199. use.
  200. Currently these are not used and must be zero.
  201. </para>
  202. </listitem>
  203. </varlistentry>
  204. <varlistentry>
  205. <term><constant>authlen</constant></term>
  206. <listitem>
  207. <para>
  208. gives the length of the authentication data.
  209. Since packet authentication is currently not used, this must be
  210. zero.
  211. </para>
  212. </listitem>
  213. </varlistentry>
  214. </variablelist>
  215. </para>
  216. <para>
  217. The following opcodes are currently defined:
  218. <variablelist>
  219. <varlistentry>
  220. <term><constant>NOOP</constant></term>
  221. <listitem>
  222. <para>
  223. Success is always returned and the packet contents are echoed.
  224. The lwres_noop_*() functions should be used for this type.
  225. </para>
  226. </listitem>
  227. </varlistentry>
  228. <varlistentry>
  229. <term><constant>GETADDRSBYNAME</constant></term>
  230. <listitem>
  231. <para>
  232. returns all known addresses for a given name.
  233. The lwres_gabn_*() functions should be used for this type.
  234. </para>
  235. </listitem>
  236. </varlistentry>
  237. <varlistentry>
  238. <term><constant>GETNAMEBYADDR</constant></term>
  239. <listitem>
  240. <para>
  241. return the hostname for the given address.
  242. The lwres_gnba_*() functions should be used for this type.
  243. </para>
  244. </listitem>
  245. </varlistentry>
  246. </variablelist>
  247. </para>
  248. <para><function>lwres_lwpacket_renderheader()</function>
  249. transfers the contents of lightweight resolver packet structure
  250. <type>lwres_lwpacket_t</type> <parameter>*pkt</parameter> in
  251. network byte order to the lightweight resolver buffer,
  252. <parameter>*b</parameter>.
  253. </para>
  254. <para><function>lwres_lwpacket_parseheader()</function>
  255. performs the converse operation. It transfers data in network
  256. byte order from buffer <parameter>*b</parameter> to resolver
  257. packet <parameter>*pkt</parameter>. The contents of the buffer
  258. <parameter>b</parameter> should correspond to a
  259. <type>lwres_lwpacket_t</type>.
  260. </para>
  261. </refsect1>
  262. <refsect1>
  263. <title>RETURN VALUES</title>
  264. <para>
  265. Successful calls to
  266. <function>lwres_lwpacket_renderheader()</function> and
  267. <function>lwres_lwpacket_parseheader()</function> return
  268. <errorcode>LWRES_R_SUCCESS</errorcode>. If there is insufficient
  269. space to copy data between the buffer <parameter>*b</parameter> and
  270. lightweight resolver packet <parameter>*pkt</parameter> both
  271. functions
  272. return <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>.
  273. </para>
  274. </refsect1>
  275. </refentry><!--
  276. - Local variables:
  277. - mode: sgml
  278. - End:
  279. -->