98N/A - Copyright (C) 2001 Internet Software Consortium. 98N/A - Permission to use, copy, modify, and distribute this software for any 98N/A - purpose with or without fee is hereby granted, provided that the above 919N/A - copyright notice and this permission notice appear in all copies. 919N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 919N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 919N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 919N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 919N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 919N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 919N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 919N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 98N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 830N/A>lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free -- lightweight resolver no-op message handling</
DIV 810N/ACLASS="FUNCSYNOPSISINFO" 810N/Alwres_nooprequest_render</
CODE 851N/A>(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 810N/Alwres_noopresponse_render</
CODE 810N/A>(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 851N/Alwres_nooprequest_parse</
CODE 851N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);</
CODE 1026N/Alwres_noopresponse_parse</
CODE 851N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);</
CODE 366N/Alwres_noopresponse_free</
CODE 354N/A>(lwres_context_t *ctx, lwres_noopresponse_t **structp);</
CODE 278N/Alwres_nooprequest_free</
CODE 98N/A>(lwres_context_t *ctx, lwres_nooprequest_t **structp);</
CODE 126N/A>These are low-level routines for creating and parsing
98N/Alightweight resolver no-op request and response messages.</
P 287N/A>The no-op message is analogous to a <
B 98N/Aa packet is sent to the resolver daemon and is simply echoed back.
98N/AThe opcode is intended to allow a client to determine if the server is
98N/Aoperational or not.</
P 851N/A>There are four main functions for the no-op opcode.
577N/AOne render function converts a no-op request structure —
98N/A>lwres_nooprequest_t</
SPAN 851N/Ato the lighweight resolver's canonical format.
98N/AIt is complemented by a parse function that converts a packet in this
744N/Acanonical format to a no-op request structure.
747N/AAnother render function converts the no-op response structure —
744N/A>lwres_noopresponse_t</
SPAN 967N/Ato the canonical format.
98N/AThis is complemented by a parse function which converts a packet in
493N/Acanonical format to a no-op response structure.</
P 967N/A>These structures are defined in
>#define LWRES_OPCODE_NOOP 0x00000000U
lwres_uint16_t datalength;
lwres_uint16_t datalength;
} lwres_noopresponse_t;</
PREAlthough 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>lwres_nooprequest_render()</
TTto convert no-op request structure
The packet header structure
is initialised and transferred to
are then appended to the buffer in canonical format.
>lwres_noopresponse_render()</
TTperforms the same task, except it converts a no-op response structure
>lwres_noopresponse_t</
SPANto the lightweight resolver's canonical format.</
P>lwres_nooprequest_parse()</
TTto convert the contents of packet
>lwres_nooprequest_t</
SPANprovides space to be used for storing this structure.
When the function succeeds, the resulting
>lwres_nooprequest_t</
SPANis made available through
>lwres_noopresponse_parse()</
TToffers the same semantics as
>lwres_nooprequest_parse()</
TT>lwres_noopresponse_t</
SPAN>lwres_noopresponse_free()</
TT>lwres_nooprequest_free()</
TTrelease the memory in resolver context
that was allocated to the
>lwres_noopresponse_t</
SPAN>lwres_nooprequest_t</
SPANstructures referenced via
>The no-op opcode functions
>lwres_nooprequest_render()</
TT>lwres_noopresponse_render()</
TT>lwres_nooprequest_parse()</
TT>lwres_noopresponse_parse()</
TTif memory allocation fails.
>LWRES_R_UNEXPECTEDEND</
SPANis returned if the available space in the buffer
is too small to accommodate the packet header or the
>lwres_nooprequest_t</
SPAN>lwres_noopresponse_t</
SPAN>lwres_nooprequest_parse()</
TT>lwres_noopresponse_parse()</
TT>LWRES_R_UNEXPECTEDEND</
SPANif the buffer is not empty after decoding the received packet.
These functions will return
in the packet header structure
indicate that the packet is not a response to an earlier query.</
P