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

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 261 lines · 250 code · 11 blank · 0 comment · 0 complexity · 1623587ae5b9113834247e1b40b41ef4 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_gabn</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_gabnrequest_render</refname>
  46. <refname>lwres_gabnresponse_render</refname>
  47. <refname>lwres_gabnrequest_parse</refname>
  48. <refname>lwres_gabnresponse_parse</refname>
  49. <refname>lwres_gabnresponse_free</refname>
  50. <refname>lwres_gabnrequest_free</refname>
  51. <refpurpose>lightweight resolver getaddrbyname message handling</refpurpose>
  52. </refnamediv>
  53. <refsynopsisdiv>
  54. <funcsynopsis>
  55. <funcsynopsisinfo>#include &lt;lwres/lwres.h&gt;</funcsynopsisinfo>
  56. <funcprototype>
  57. <funcdef>
  58. lwres_result_t
  59. <function>lwres_gabnrequest_render</function></funcdef>
  60. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  61. <paramdef>lwres_gabnrequest_t *<parameter>req</parameter></paramdef>
  62. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  63. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  64. </funcprototype>
  65. <funcprototype>
  66. <funcdef>
  67. lwres_result_t
  68. <function>lwres_gabnresponse_render</function></funcdef>
  69. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  70. <paramdef>lwres_gabnresponse_t *<parameter>req</parameter></paramdef>
  71. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  72. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  73. </funcprototype>
  74. <funcprototype>
  75. <funcdef>
  76. lwres_result_t
  77. <function>lwres_gabnrequest_parse</function></funcdef>
  78. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  79. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  80. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  81. <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
  82. </funcprototype>
  83. <funcprototype>
  84. <funcdef>
  85. lwres_result_t
  86. <function>lwres_gabnresponse_parse</function></funcdef>
  87. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  88. <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
  89. <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
  90. <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
  91. </funcprototype>
  92. <funcprototype>
  93. <funcdef>
  94. void
  95. <function>lwres_gabnresponse_free</function></funcdef>
  96. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  97. <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
  98. </funcprototype>
  99. <funcprototype>
  100. <funcdef>
  101. void
  102. <function>lwres_gabnrequest_free</function></funcdef>
  103. <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
  104. <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
  105. </funcprototype>
  106. </funcsynopsis>
  107. </refsynopsisdiv>
  108. <refsect1>
  109. <title>DESCRIPTION</title>
  110. <para>
  111. These are low-level routines for creating and parsing
  112. lightweight resolver name-to-address lookup request and
  113. response messages.
  114. </para>
  115. <para>
  116. There are four main functions for the getaddrbyname opcode.
  117. One render function converts a getaddrbyname request structure &mdash;
  118. <type>lwres_gabnrequest_t</type> &mdash;
  119. to the lighweight resolver's canonical format.
  120. It is complemented by a parse function that converts a packet in this
  121. canonical format to a getaddrbyname request structure.
  122. Another render function converts the getaddrbyname response structure
  123. &mdash; <type>lwres_gabnresponse_t</type> &mdash;
  124. to the canonical format.
  125. This is complemented by a parse function which converts a packet in
  126. canonical format to a getaddrbyname response structure.
  127. </para>
  128. <para>
  129. These structures are defined in
  130. <filename>&lt;lwres/lwres.h&gt;</filename>.
  131. They are shown below.
  132. </para>
  133. <para><programlisting>
  134. #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
  135. </programlisting>
  136. </para>
  137. <para><programlisting>
  138. typedef struct lwres_addr lwres_addr_t;
  139. typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
  140. </programlisting>
  141. </para>
  142. <para><programlisting>
  143. typedef struct {
  144. lwres_uint32_t flags;
  145. lwres_uint32_t addrtypes;
  146. lwres_uint16_t namelen;
  147. char *name;
  148. } lwres_gabnrequest_t;
  149. </programlisting>
  150. </para>
  151. <para><programlisting>
  152. typedef struct {
  153. lwres_uint32_t flags;
  154. lwres_uint16_t naliases;
  155. lwres_uint16_t naddrs;
  156. char *realname;
  157. char **aliases;
  158. lwres_uint16_t realnamelen;
  159. lwres_uint16_t *aliaslen;
  160. lwres_addrlist_t addrs;
  161. void *base;
  162. size_t baselen;
  163. } lwres_gabnresponse_t;
  164. </programlisting>
  165. </para>
  166. <para><function>lwres_gabnrequest_render()</function>
  167. uses resolver context <parameter>ctx</parameter> to convert
  168. getaddrbyname request structure <parameter>req</parameter> to
  169. canonical format. The packet header structure
  170. <parameter>pkt</parameter> is initialised and transferred to
  171. buffer <parameter>b</parameter>.
  172. The contents of <parameter>*req</parameter> are then appended to
  173. the buffer in canonical format.
  174. <function>lwres_gabnresponse_render()</function> performs the
  175. same task, except it converts a getaddrbyname response structure
  176. <type>lwres_gabnresponse_t</type> to the lightweight resolver's
  177. canonical format.
  178. </para>
  179. <para><function>lwres_gabnrequest_parse()</function>
  180. uses context <parameter>ctx</parameter> to convert the contents
  181. of packet <parameter>pkt</parameter> to a
  182. <type>lwres_gabnrequest_t</type> structure. Buffer
  183. <parameter>b</parameter> provides space to be used for storing
  184. this structure. When the function succeeds, the resulting
  185. <type>lwres_gabnrequest_t</type> is made available through
  186. <parameter>*structp</parameter>.
  187. <function>lwres_gabnresponse_parse()</function> offers the same
  188. semantics as <function>lwres_gabnrequest_parse()</function>
  189. except it yields a <type>lwres_gabnresponse_t</type> structure.
  190. </para>
  191. <para><function>lwres_gabnresponse_free()</function>
  192. and <function>lwres_gabnrequest_free()</function> release the
  193. memory in resolver context <parameter>ctx</parameter> that was
  194. allocated to the <type>lwres_gabnresponse_t</type> or
  195. <type>lwres_gabnrequest_t</type> structures referenced via
  196. <parameter>structp</parameter>.
  197. Any memory associated with ancillary buffers and strings for
  198. those structures is also discarded.
  199. </para>
  200. </refsect1>
  201. <refsect1>
  202. <title>RETURN VALUES</title>
  203. <para>
  204. The getaddrbyname opcode functions
  205. <function>lwres_gabnrequest_render()</function>,
  206. <function>lwres_gabnresponse_render()</function>
  207. <function>lwres_gabnrequest_parse()</function>
  208. and
  209. <function>lwres_gabnresponse_parse()</function>
  210. all return
  211. <errorcode>LWRES_R_SUCCESS</errorcode>
  212. on success.
  213. They return
  214. <errorcode>LWRES_R_NOMEMORY</errorcode>
  215. if memory allocation fails.
  216. <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
  217. is returned if the available space in the buffer
  218. <parameter>b</parameter>
  219. is too small to accommodate the packet header or the
  220. <type>lwres_gabnrequest_t</type>
  221. and
  222. <type>lwres_gabnresponse_t</type>
  223. structures.
  224. <function>lwres_gabnrequest_parse()</function>
  225. and
  226. <function>lwres_gabnresponse_parse()</function>
  227. will return
  228. <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
  229. if the buffer is not empty after decoding the received packet.
  230. These functions will return
  231. <errorcode>LWRES_R_FAILURE</errorcode>
  232. if
  233. <structfield>pktflags</structfield>
  234. in the packet header structure
  235. <type>lwres_lwpacket_t</type>
  236. indicate that the packet is not a response to an earlier query.
  237. </para>
  238. </refsect1>
  239. <refsect1>
  240. <title>SEE ALSO</title>
  241. <para><citerefentry>
  242. <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>
  243. </citerefentry>
  244. </para>
  245. </refsect1>
  246. </refentry><!--
  247. - Local variables:
  248. - mode: sgml
  249. - End:
  250. -->