0N/A - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC") 0N/A - This Source Code Form is subject to the terms of the Mozilla Public 2362N/A - License, v. 2.0. If a copy of the MPL was not distributed with this 0N/A<
meta http-
equiv="Content-Type" content="text/html; charset=ISO-8859-1">
0N/A<
title>lwres_noop</
title>
0N/A<
meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
0N/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 lwres_nooprequest_render,
0N/A lwres_noopresponse_render,
0N/A lwres_nooprequest_parse,
0N/A lwres_noopresponse_parse,
0N/A lwres_noopresponse_free,
0N/A lwres_nooprequest_free
0N/A — lightweight resolver no-op message handling
0N/A <
div class="refsynopsisdiv">
0N/A <
div class="funcsynopsis">
0N/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">
0N/A<
b class="fsfunc">lwres_nooprequest_render</
b>(</
code></
td>
0N/A<
td>lwres_context_t *<
var class="pdparam">ctx</
var>, </
td>
0N/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">
0N/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;">
0N/A<
td><
code class="funcdef">
0N/A<
b class="fsfunc">lwres_noopresponse_free</
b>(</
code></
td>
0N/A<
td>lwres_context_t *<
var class="pdparam">ctx</
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;">
0N/A<
td><
code class="funcdef">
0N/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.
It is complemented by a parse function that converts a packet in this
canonical format to a no-op request structure.
Another render function converts the no-op response structure —
<
span class="type">lwres_noopresponse_t</
span>
This is complemented by a parse function which converts a packet in
canonical format to a no-op response structure.
These structures are defined in
<
pre class="programlisting">
#define LWRES_OPCODE_NOOP 0x00000000U
<
pre class="programlisting">
lwres_uint16_t datalength;
<
pre class="programlisting">
lwres_uint16_t datalength;
Although the structures have different types, they are identical.
This is because the no-op opcode simply echos whatever data was sent:
the response is therefore identical to the request.
<
p><
code class="function">lwres_nooprequest_render()</
code>
uses resolver context <
em class="parameter"><
code>ctx</
code></
em> to convert
no-op request structure <
em class="parameter"><
code>req</
code></
em> to canonical
format. The packet header structure <
em class="parameter"><
code>pkt</
code></
em>
is initialised and transferred to buffer
<
em class="parameter"><
code>b</
code></
em>. The contents of
<
em class="parameter"><
code>*req</
code></
em> are then appended to the buffer in
<
code class="function">lwres_noopresponse_render()</
code> performs the
same task, except it converts a no-op response structure
<
span class="type">lwres_noopresponse_t</
span> to the lightweight resolver's
<
p><
code class="function">lwres_nooprequest_parse()</
code>
uses context <
em class="parameter"><
code>ctx</
code></
em> to convert the contents
of packet <
em class="parameter"><
code>pkt</
code></
em> to a
<
span class="type">lwres_nooprequest_t</
span> structure. Buffer
<
em class="parameter"><
code>b</
code></
em> provides space to be used for storing
this structure. When the function succeeds, the resulting
<
span class="type">lwres_nooprequest_t</
span> is made available through
<
em class="parameter"><
code>*structp</
code></
em>.
<
code class="function">lwres_noopresponse_parse()</
code> offers the same
semantics as <
code class="function">lwres_nooprequest_parse()</
code>
except it yields a <
span class="type">lwres_noopresponse_t</
span> structure.
<
p><
code class="function">lwres_noopresponse_free()</
code>
and <
code class="function">lwres_nooprequest_free()</
code> release the
memory in resolver context <
em class="parameter"><
code>ctx</
code></
em> that was
allocated to the <
span class="type">lwres_noopresponse_t</
span> or
<
span class="type">lwres_nooprequest_t</
span> structures referenced via
<
em class="parameter"><
code>structp</
code></
em>.
<
a name="id-1.8"></
a><
h2>RETURN VALUES</
h2>
The no-op opcode functions
<
code class="function">lwres_nooprequest_render()</
code>,
<
code class="function">lwres_noopresponse_render()</
code>
<
code class="function">lwres_nooprequest_parse()</
code>
<
code class="function">lwres_noopresponse_parse()</
code>
<
span class="errorcode">LWRES_R_SUCCESS</
span>
<
span class="errorcode">LWRES_R_NOMEMORY</
span>
if memory allocation fails.
<
span class="errorcode">LWRES_R_UNEXPECTEDEND</
span>
is returned if the available space in the buffer
<
em class="parameter"><
code>b</
code></
em>
is too small to accommodate the packet header or the
<
span class="type">lwres_nooprequest_t</
span>
<
span class="type">lwres_noopresponse_t</
span>
<
code class="function">lwres_nooprequest_parse()</
code>
<
code class="function">lwres_noopresponse_parse()</
code>
<
span class="errorcode">LWRES_R_UNEXPECTEDEND</
span>
if the buffer is not empty after decoding the received packet.
These functions will return
<
span class="errorcode">LWRES_R_FAILURE</
span>
<
code class="constant">pktflags</
code>
in the packet header structure
<
span class="type">lwres_lwpacket_t</
span>
indicate that the packet is not a response to an earlier query.
<
a name="id-1.9"></
a><
h2>SEE ALSO</
h2>
<
p><
span class="citerefentry">
<
span class="refentrytitle">lwres_packet</
span>(3)