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