lwres_noop.html revision a24330c4805a224191ab687d0291963062fe3355
794b79e6bbc3f5db1ea6ae154d739b9f1ef1a375Tinderbox User - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews - Copyright (C) 2000, 2001 Internet Software Consortium.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater - Permission to use, copy, modify, and/or distribute this software for any
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson - purpose with or without fee is hereby granted, provided that the above
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson - copyright notice and this permission notice appear in all copies.
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews - PERFORMANCE OF THIS SOFTWARE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews<meta name="generator" content="DocBook XSL Stylesheets V1.71.1">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User<a name="id2476274"></a><div class="titlepage"></div>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<p>lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free — lightweight resolver no-op message handling</p>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlwres_result_t
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_nooprequest_render</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlwres_result_t
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_noopresponse_render</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlwres_result_t
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_nooprequest_parse</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<var class="pdparam">structp</var><code>)</code>;</td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinlwres_result_t
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_noopresponse_parse</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<var class="pdparam">structp</var><code>)</code>;</td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_noopresponse_free</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<var class="pdparam">structp</var><code>)</code>;</td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_nooprequest_free</b>(</code></td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<var class="pdparam">structp</var><code>)</code>;</td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein These are low-level routines for creating and parsing
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein lightweight resolver no-op request and response messages.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein The no-op message is analogous to a <span><strong class="command">ping</strong></span>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein a packet is sent to the resolver daemon and is simply echoed back.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein The opcode is intended to allow a client to determine if the server is
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein operational or not.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein There are four main functions for the no-op opcode.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein One render function converts a no-op request structure —
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">lwres_nooprequest_t</span> —
a24330c4805a224191ab687d0291963062fe3355Tinderbox User to the lightweight resolver's canonical format.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein It is complemented by a parse function that converts a packet in this
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein canonical format to a no-op request structure.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Another render function converts the no-op response structure —
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein to the canonical format.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein This is complemented by a parse function which converts a packet in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein canonical format to a no-op response structure.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein These structures are defined in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein They are shown below.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#define LWRES_OPCODE_NOOP 0x00000000U
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafssontypedef struct {
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson lwres_uint16_t datalength;
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson unsigned char *data;
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson} lwres_nooprequest_t;
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafssontypedef struct {
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson lwres_uint16_t datalength;
8eea877894ea5bcf5cdd9ca124a8601ad421d753Andreas Gustafsson unsigned char *data;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein} lwres_noopresponse_t;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Although the structures have different types, they are identical.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein This is because the no-op opcode simply echos whatever data was sent:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the response is therefore identical to the request.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<p><code class="function">lwres_nooprequest_render()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein uses resolver context <em class="parameter"><code>ctx</code></em> to convert
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein no-op request structure <em class="parameter"><code>req</code></em> to canonical
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein format. The packet header structure <em class="parameter"><code>pkt</code></em>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein is initialised and transferred to buffer
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>b</code></em>. The contents of
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>*req</code></em> are then appended to the buffer in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein canonical format.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_noopresponse_render()</code> performs the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein same task, except it converts a no-op response structure
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">lwres_noopresponse_t</span> to the lightweight resolver's
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein canonical format.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<p><code class="function">lwres_nooprequest_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein uses context <em class="parameter"><code>ctx</code></em> to convert the contents
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein of packet <em class="parameter"><code>pkt</code></em> to a
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">lwres_nooprequest_t</span> structure. Buffer
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>b</code></em> provides space to be used for storing
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein this structure. When the function succeeds, the resulting
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">lwres_nooprequest_t</span> is made available through
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>*structp</code></em>.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_noopresponse_parse()</code> offers the same
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein semantics as <code class="function">lwres_nooprequest_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein except it yields a <span class="type">lwres_noopresponse_t</span> structure.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<p><code class="function">lwres_noopresponse_free()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein and <code class="function">lwres_nooprequest_free()</code> release the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein memory in resolver context <em class="parameter"><code>ctx</code></em> that was
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein allocated to the <span class="type">lwres_noopresponse_t</span> or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">lwres_nooprequest_t</span> structures referenced via
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>structp</code></em>.
794b79e6bbc3f5db1ea6ae154d739b9f1ef1a375Tinderbox User<a name="id2543675"></a><h2>RETURN VALUES</h2>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein The no-op opcode functions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_nooprequest_render()</code>,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_noopresponse_render()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_nooprequest_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_noopresponse_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if memory allocation fails.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein is returned if the available space in the buffer
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein is too small to accommodate the packet header or the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_nooprequest_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_noopresponse_parse()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if the buffer is not empty after decoding the received packet.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein These functions will return
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein in the packet header structure
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein indicate that the packet is not a response to an earlier query.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>