lwres_noop.html revision 5fa6a064b8301e4f274bd132fd577def59e4fb4c
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
c7ef13f6c9ef4436bc804b150e0a93307b11fa27Tinderbox User - Copyright (C) 2000, 2001 Internet Software Consortium.
a5636b773fa05a272b6876afd99309c0b3090e2fMark Andrews - Permission to use, copy, modify, and/or distribute this software for any
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User - purpose with or without fee is hereby granted, provided that the above
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User - copyright notice and this permission notice appear in all copies.
5e047890ac9b745db060d95f7d1b4f876511240dTinderbox User - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
137fdbc214e99c4cbe57551e9e14f2015c2e42aeTinderbox User - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
bed0874e1a09e810575328c4bfc346a47514b69fMark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
02b47c5d62e1e827743684c28a08e871da454a2dMark Andrews - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User - PERFORMANCE OF THIS SOFTWARE.
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<meta name="generator" content="DocBook XSL Stylesheets V1.71.1">
e20309353e6246485c521278131d3fced73d7957Tinderbox User<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<a name="id2476282"></a><div class="titlepage"></div>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<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>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt<b class="fsfunc">lwres_nooprequest_render</b>(</code></td>
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User<var class="pdparam">b</var><code>)</code>;</td>
24934f08b9ff81c2be711e566e8002d145573031Tinderbox User<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
7feccf248d2a20a2ae48b290f58ded5abc853e9aTinderbox Userlwres_result_t
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<b class="fsfunc">lwres_noopresponse_render</b>(</code></td>
b871c7156eb037d41f53828c6fcb9cc876128962Mark Andrews<var class="pdparam">b</var><code>)</code>;</td>
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox Userlwres_result_t
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User<b class="fsfunc">lwres_nooprequest_parse</b>(</code></td>
01a5c5503482fb3ba52088bf0178a7213273bf96Mark Andrews<var class="pdparam">structp</var><code>)</code>;</td>
df4ebd8217d02dafc12145b55c4d93d0255d1ec7Tinderbox User<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<b class="fsfunc">lwres_noopresponse_parse</b>(</code></td>
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User<var class="pdparam">structp</var><code>)</code>;</td>
c7ef13f6c9ef4436bc804b150e0a93307b11fa27Tinderbox User<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
d642d3857129678797a01adee14fbd70335b05a9Mark Andrews<b class="fsfunc">lwres_noopresponse_free</b>(</code></td>
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews<var class="pdparam">structp</var><code>)</code>;</td>
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater<b class="fsfunc">lwres_nooprequest_free</b>(</code></td>
609b8d08176469485edce25f3c2f50365bbd3819Mark Andrews<var class="pdparam">structp</var><code>)</code>;</td>
7f94d9a8162c9a96b56e66176702b66e79d8e1a2Automatic Updater<a name="id2543533"></a><h2>DESCRIPTION</h2>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater These are low-level routines for creating and parsing
5ecad47f69b3fd945472ab2900a9ff826a7ce2f6Automatic Updater lightweight resolver no-op request and response messages.
6a9d2121152c94cb9e35832126c3f2e4d18d81edTinderbox User The no-op message is analogous to a <span><strong class="command">ping</strong></span>
7262eb86f2b465822206122921e2f357218f0cfdAutomatic Updater a packet is sent to the resolver daemon and is simply echoed back.
96ea71632887c58a9d00f47eb318bf76b35903c3Mark Andrews The opcode is intended to allow a client to determine if the server is
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater operational or not.
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater There are four main functions for the no-op opcode.
4cda4fd158d6ded5586bacea8c388445d99611eaAutomatic Updater One render function converts a no-op request structure —
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews <span class="type">lwres_nooprequest_t</span> —
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews to the lightweight resolver's canonical format.
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater It is complemented by a parse function that converts a packet in this
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews canonical format to a no-op request structure.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater Another render function converts the no-op response structure —
6a9d2121152c94cb9e35832126c3f2e4d18d81edTinderbox User <span class="type">lwres_noopresponse_t</span>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews to the canonical format.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews This is complemented by a parse function which converts a packet in
27c3c21f41520e8d6336d80a8094389e321cb6d2Mark Andrews canonical format to a no-op response structure.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews These structures are defined in
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <code class="filename">lwres/lwres.h</code>.
f751b1576ee6fef4023bf7101d10167e4fe520f3Tinderbox User They are shown below.
da59e63e7af147a8bcef985b98b04443e04c3a0eTinderbox User#define LWRES_OPCODE_NOOP 0x00000000U
0ea1646bf1253f50946ed5e4d3c01c1d2767012bTinderbox Usertypedef struct {
27c3c21f41520e8d6336d80a8094389e321cb6d2Mark Andrews lwres_uint16_t datalength;
dc5552b4df5e3821783821c8d4e734c1608c446eTinderbox User unsigned char *data;
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater} lwres_nooprequest_t;
cd6e9010079a4e58f7e30063df3dec0ff154ad59Tinderbox Usertypedef struct {
a382ca49c874d38ad3ac8995b49f9f27128e4ca9Automatic Updater lwres_uint16_t datalength;
fe600c3ad88c0bb078283a953d048087d227c0e5Tinderbox User unsigned char *data;
bbc0e1c4f47f101c4a64db3469352c49a49e734fTinderbox User} lwres_noopresponse_t;
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User Although the structures have different types, they are identical.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews This is because the no-op opcode simply echos whatever data was sent:
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater the response is therefore identical to the request.
e2caa7536302de34de6cc04025abcd53dc3a499aAutomatic Updater<p><code class="function">lwres_nooprequest_render()</code>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User uses resolver context <em class="parameter"><code>ctx</code></em> to convert
8292deab031e7599cd7622aa7675fbe139ca6095Mark Andrews no-op request structure <em class="parameter"><code>req</code></em> to canonical
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews format. The packet header structure <em class="parameter"><code>pkt</code></em>
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews is initialised and transferred to buffer
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews <em class="parameter"><code>b</code></em>. The contents of
e31cfd80616deb9781902306b34a69aa7309b6cbTinderbox User <em class="parameter"><code>*req</code></em> are then appended to the buffer in
e31cfd80616deb9781902306b34a69aa7309b6cbTinderbox User canonical format.
e31cfd80616deb9781902306b34a69aa7309b6cbTinderbox User <code class="function">lwres_noopresponse_render()</code> performs the
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews same task, except it converts a no-op response structure
b109432c3a939bff66a463be86c371bd88efe3aaAutomatic Updater <span class="type">lwres_noopresponse_t</span> to the lightweight resolver's
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater canonical format.
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews<p><code class="function">lwres_nooprequest_parse()</code>
3351ccbd5c1961404044f8273d54dad405f53960Mark Andrews uses context <em class="parameter"><code>ctx</code></em> to convert the contents
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater of packet <em class="parameter"><code>pkt</code></em> to a
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <span class="type">lwres_nooprequest_t</span> structure. Buffer
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <em class="parameter"><code>b</code></em> provides space to be used for storing
3351ccbd5c1961404044f8273d54dad405f53960Mark Andrews this structure. When the function succeeds, the resulting
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater <span class="type">lwres_nooprequest_t</span> is made available through
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <em class="parameter"><code>*structp</code></em>.
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews <code class="function">lwres_noopresponse_parse()</code> offers the same
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater semantics as <code class="function">lwres_nooprequest_parse()</code>
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews except it yields a <span class="type">lwres_noopresponse_t</span> structure.
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater<p><code class="function">lwres_noopresponse_free()</code>
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater and <code class="function">lwres_nooprequest_free()</code> release the
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater memory in resolver context <em class="parameter"><code>ctx</code></em> that was
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater allocated to the <span class="type">lwres_noopresponse_t</span> or
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater <span class="type">lwres_nooprequest_t</span> structures referenced via
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater <em class="parameter"><code>structp</code></em>.
82a986aaa5d3384a541b5a7d6dae8cf0726d6513Tinderbox User The no-op opcode functions
c7ef13f6c9ef4436bc804b150e0a93307b11fa27Tinderbox User <code class="function">lwres_nooprequest_render()</code>,
82a986aaa5d3384a541b5a7d6dae8cf0726d6513Tinderbox User <code class="function">lwres_noopresponse_render()</code>
dc435f1033bcba88b748074987db6cfd34c057a4Tinderbox User <code class="function">lwres_nooprequest_parse()</code>
dc435f1033bcba88b748074987db6cfd34c057a4Tinderbox User <code class="function">lwres_noopresponse_parse()</code>
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User <span class="errorcode">LWRES_R_SUCCESS</span>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews <span class="errorcode">LWRES_R_NOMEMORY</span>
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User if memory allocation fails.
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews is returned if the available space in the buffer
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews is too small to accommodate the packet header or the
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User <span class="type">lwres_nooprequest_t</span>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="type">lwres_noopresponse_t</span>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater <code class="function">lwres_nooprequest_parse()</code>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater <code class="function">lwres_noopresponse_parse()</code>
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User if the buffer is not empty after decoding the received packet.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington These functions will return
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="errorcode">LWRES_R_FAILURE</span>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User in the packet header structure
b13d89bd89878137c81b36a36596cca3920f27a4Automatic Updater <span class="type">lwres_lwpacket_t</span>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User indicate that the packet is not a response to an earlier query.
a5636b773fa05a272b6876afd99309c0b3090e2fMark Andrews<p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>