Blame lib/lwres/man/lwres_gabn.docbook

Packit Service ae04f2
Packit Service ae04f2
]>
Packit Service ae04f2
Packit Service ae04f2
 - Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Packit Service ae04f2
 -
Packit Service ae04f2
 - This Source Code Form is subject to the terms of the Mozilla Public
Packit Service ae04f2
 - License, v. 2.0. If a copy of the MPL was not distributed with this
Packit Service ae04f2
 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
Packit Service ae04f2
 -
Packit Service ae04f2
 - See the COPYRIGHT file distributed with this work for additional
Packit Service ae04f2
 - information regarding copyright ownership.
Packit Service ae04f2
-->
Packit Service ae04f2
Packit Service ae04f2
Packit Service ae04f2
<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0">
Packit Service ae04f2
  <info>
Packit Service ae04f2
    <date>2007-06-18</date>
Packit Service ae04f2
  </info>
Packit Service ae04f2
  <refentryinfo>
Packit Service ae04f2
    <corpname>ISC</corpname>
Packit Service ae04f2
    <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
Packit Service ae04f2
  </refentryinfo>
Packit Service ae04f2
Packit Service ae04f2
  <refmeta>
Packit Service ae04f2
    <refentrytitle>lwres_gabn</refentrytitle>
Packit Service ae04f2
    <manvolnum>3</manvolnum>
Packit Service ae04f2
    <refmiscinfo>BIND9</refmiscinfo>
Packit Service ae04f2
  </refmeta>
Packit Service ae04f2
Packit Service ae04f2
  <docinfo>
Packit Service ae04f2
    <copyright>
Packit Service ae04f2
      <year>2000</year>
Packit Service ae04f2
      <year>2001</year>
Packit Service ae04f2
      <year>2004</year>
Packit Service ae04f2
      <year>2005</year>
Packit Service ae04f2
      <year>2007</year>
Packit Service ae04f2
      <year>2014</year>
Packit Service ae04f2
      <year>2015</year>
Packit Service ae04f2
      <year>2016</year>
Packit Service ae04f2
      <year>2018</year>
Packit Service ae04f2
      <year>2019</year>
Packit Service ae04f2
      <year>2020</year>
Packit Service ae04f2
      <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
Packit Service ae04f2
    </copyright>
Packit Service ae04f2
  </docinfo>
Packit Service ae04f2
Packit Service ae04f2
  <refnamediv>
Packit Service ae04f2
    <refname>lwres_gabnrequest_render</refname>
Packit Service ae04f2
    <refname>lwres_gabnresponse_render</refname>
Packit Service ae04f2
    <refname>lwres_gabnrequest_parse</refname>
Packit Service ae04f2
    <refname>lwres_gabnresponse_parse</refname>
Packit Service ae04f2
    <refname>lwres_gabnresponse_free</refname>
Packit Service ae04f2
    <refname>lwres_gabnrequest_free</refname>
Packit Service ae04f2
    <refpurpose>lightweight resolver getaddrbyname message handling</refpurpose>
Packit Service ae04f2
  </refnamediv>
Packit Service ae04f2
  <refsynopsisdiv>
Packit Service ae04f2
    <funcsynopsis>
Packit Service ae04f2
<funcsynopsisinfo>#include <lwres/lwres.h></funcsynopsisinfo>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
lwres_result_t
Packit Service ae04f2
<function>lwres_gabnrequest_render</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnrequest_t *<parameter>req</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
Packit Service ae04f2
        </funcprototype>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
lwres_result_t
Packit Service ae04f2
<function>lwres_gabnresponse_render</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnresponse_t *<parameter>req</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
Packit Service ae04f2
        </funcprototype>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
lwres_result_t
Packit Service ae04f2
<function>lwres_gabnrequest_parse</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
Packit Service ae04f2
        </funcprototype>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
lwres_result_t
Packit Service ae04f2
<function>lwres_gabnresponse_parse</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
Packit Service ae04f2
        </funcprototype>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
void
Packit Service ae04f2
<function>lwres_gabnresponse_free</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
Packit Service ae04f2
        </funcprototype>
Packit Service ae04f2
<funcprototype>
Packit Service ae04f2
        <funcdef>
Packit Service ae04f2
void
Packit Service ae04f2
<function>lwres_gabnrequest_free</function></funcdef>
Packit Service ae04f2
        <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
Packit Service ae04f2
        <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
Packit Service ae04f2
      </funcprototype>
Packit Service ae04f2
</funcsynopsis>
Packit Service ae04f2
  </refsynopsisdiv>
Packit Service ae04f2
  <refsection><info><title>DESCRIPTION</title></info>
Packit Service ae04f2
Packit Service ae04f2
    <para>
Packit Service ae04f2
      These are low-level routines for creating and parsing
Packit Service ae04f2
      lightweight resolver name-to-address lookup request and
Packit Service ae04f2
      response messages.
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para>
Packit Service ae04f2
      There are four main functions for the getaddrbyname opcode.
Packit Service ae04f2
      One render function converts a getaddrbyname request structure —
Packit Service ae04f2
      <type>lwres_gabnrequest_t</type> —
Packit Service ae04f2
      to the lightweight resolver's canonical format.
Packit Service ae04f2
      It is complemented by a parse function that converts a packet in this
Packit Service ae04f2
      canonical format to a getaddrbyname request structure.
Packit Service ae04f2
      Another render function converts the getaddrbyname response structure
Packit Service ae04f2
      — <type>lwres_gabnresponse_t</type> —
Packit Service ae04f2
      to the canonical format.
Packit Service ae04f2
      This is complemented by a parse function which converts a packet in
Packit Service ae04f2
      canonical format to a getaddrbyname response structure.
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para>
Packit Service ae04f2
      These structures are defined in
Packit Service ae04f2
      <filename><lwres/lwres.h></filename>.
Packit Service ae04f2
      They are shown below.
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para><programlisting>
Packit Service ae04f2
#define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
Packit Service ae04f2
</programlisting>
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para><programlisting>
Packit Service ae04f2
typedef struct lwres_addr lwres_addr_t;
Packit Service ae04f2
typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
Packit Service ae04f2
</programlisting>
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para><programlisting>
Packit Service ae04f2
typedef struct {
Packit Service ae04f2
        uint32_t  flags;
Packit Service ae04f2
        uint32_t  addrtypes;
Packit Service ae04f2
        uint16_t  namelen;
Packit Service ae04f2
        char           *name;
Packit Service ae04f2
} lwres_gabnrequest_t;
Packit Service ae04f2
</programlisting>
Packit Service ae04f2
    </para>
Packit Service ae04f2
    <para><programlisting>
Packit Service ae04f2
typedef struct {
Packit Service ae04f2
        uint32_t          flags;
Packit Service ae04f2
        uint16_t          naliases;
Packit Service ae04f2
        uint16_t          naddrs;
Packit Service ae04f2
        char                   *realname;
Packit Service ae04f2
        char                  **aliases;
Packit Service ae04f2
        uint16_t          realnamelen;
Packit Service ae04f2
        uint16_t         *aliaslen;
Packit Service ae04f2
        lwres_addrlist_t        addrs;
Packit Service ae04f2
        void                   *base;
Packit Service ae04f2
        size_t                  baselen;
Packit Service ae04f2
} lwres_gabnresponse_t;
Packit Service ae04f2
</programlisting>
Packit Service ae04f2
    </para>
Packit Service ae04f2
Packit Service ae04f2
    <para><function>lwres_gabnrequest_render()</function>
Packit Service ae04f2
      uses resolver context <parameter>ctx</parameter> to convert
Packit Service ae04f2
      getaddrbyname request structure <parameter>req</parameter> to
Packit Service ae04f2
      canonical format.  The packet header structure
Packit Service ae04f2
      <parameter>pkt</parameter> is initialised and transferred to
Packit Service ae04f2
      buffer <parameter>b</parameter>.
Packit Service ae04f2
Packit Service ae04f2
      The contents of <parameter>*req</parameter> are then appended to
Packit Service ae04f2
      the buffer in canonical format.
Packit Service ae04f2
      <function>lwres_gabnresponse_render()</function> performs the
Packit Service ae04f2
      same task, except it converts a getaddrbyname response structure
Packit Service ae04f2
      <type>lwres_gabnresponse_t</type> to the lightweight resolver's
Packit Service ae04f2
      canonical format.
Packit Service ae04f2
    </para>
Packit Service ae04f2
Packit Service ae04f2
    <para><function>lwres_gabnrequest_parse()</function>
Packit Service ae04f2
      uses context <parameter>ctx</parameter> to convert the contents
Packit Service ae04f2
      of packet <parameter>pkt</parameter> to a
Packit Service ae04f2
      <type>lwres_gabnrequest_t</type> structure.  Buffer
Packit Service ae04f2
      <parameter>b</parameter> provides space to be used for storing
Packit Service ae04f2
      this structure.  When the function succeeds, the resulting
Packit Service ae04f2
      <type>lwres_gabnrequest_t</type> is made available through
Packit Service ae04f2
      <parameter>*structp</parameter>.
Packit Service ae04f2
Packit Service ae04f2
      <function>lwres_gabnresponse_parse()</function> offers the same
Packit Service ae04f2
      semantics as <function>lwres_gabnrequest_parse()</function>
Packit Service ae04f2
      except it yields a <type>lwres_gabnresponse_t</type> structure.
Packit Service ae04f2
    </para>
Packit Service ae04f2
Packit Service ae04f2
    <para><function>lwres_gabnresponse_free()</function>
Packit Service ae04f2
      and <function>lwres_gabnrequest_free()</function> release the
Packit Service ae04f2
      memory in resolver context <parameter>ctx</parameter> that was
Packit Service ae04f2
      allocated to the <type>lwres_gabnresponse_t</type> or
Packit Service ae04f2
      <type>lwres_gabnrequest_t</type> structures referenced via
Packit Service ae04f2
      <parameter>structp</parameter>.
Packit Service ae04f2
Packit Service ae04f2
      Any memory associated with ancillary buffers and strings for
Packit Service ae04f2
      those structures is also discarded.
Packit Service ae04f2
    </para>
Packit Service ae04f2
  </refsection>
Packit Service ae04f2
  <refsection><info><title>RETURN VALUES</title></info>
Packit Service ae04f2
Packit Service ae04f2
    <para>
Packit Service ae04f2
      The getaddrbyname opcode functions
Packit Service ae04f2
      <function>lwres_gabnrequest_render()</function>,
Packit Service ae04f2
      <function>lwres_gabnresponse_render()</function>
Packit Service ae04f2
      <function>lwres_gabnrequest_parse()</function>
Packit Service ae04f2
      and
Packit Service ae04f2
      <function>lwres_gabnresponse_parse()</function>
Packit Service ae04f2
      all return
Packit Service ae04f2
      <errorcode>LWRES_R_SUCCESS</errorcode>
Packit Service ae04f2
      on success.
Packit Service ae04f2
      They return
Packit Service ae04f2
      <errorcode>LWRES_R_NOMEMORY</errorcode>
Packit Service ae04f2
      if memory allocation fails.
Packit Service ae04f2
      <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
Packit Service ae04f2
      is returned if the available space in the buffer
Packit Service ae04f2
      <parameter>b</parameter>
Packit Service ae04f2
      is too small to accommodate the packet header or the
Packit Service ae04f2
      <type>lwres_gabnrequest_t</type>
Packit Service ae04f2
      and
Packit Service ae04f2
      <type>lwres_gabnresponse_t</type>
Packit Service ae04f2
      structures.
Packit Service ae04f2
      <function>lwres_gabnrequest_parse()</function>
Packit Service ae04f2
      and
Packit Service ae04f2
      <function>lwres_gabnresponse_parse()</function>
Packit Service ae04f2
      will return
Packit Service ae04f2
      <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
Packit Service ae04f2
      if the buffer is not empty after decoding the received packet.
Packit Service ae04f2
      These functions will return
Packit Service ae04f2
      <errorcode>LWRES_R_FAILURE</errorcode>
Packit Service ae04f2
      if
Packit Service ae04f2
      <varname remap="structfield">pktflags</varname>
Packit Service ae04f2
      in the packet header structure
Packit Service ae04f2
      <type>lwres_lwpacket_t</type>
Packit Service ae04f2
      indicate that the packet is not a response to an earlier query.
Packit Service ae04f2
    </para>
Packit Service ae04f2
  </refsection>
Packit Service ae04f2
  <refsection><info><title>SEE ALSO</title></info>
Packit Service ae04f2
Packit Service ae04f2
    <para><citerefentry>
Packit Service ae04f2
        <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>
Packit Service ae04f2
      </citerefentry>
Packit Service ae04f2
    </para>
Packit Service ae04f2
  </refsection>
Packit Service ae04f2
</refentry>