1 .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
16 .\" $Id: lwres_noop.3,v 1.14.2.2 2004/03/15 04:45:04 marka Exp $
18 .TH "LWRES_NOOP" "3" "Jun 30, 2000" "BIND9" ""
20 lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free \- lightweight resolver no-op message handling
22 \fB#include <lwres/lwres.h>
26 lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
31 lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
36 lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);
41 lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);
46 lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp);
51 lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp);
56 These are low-level routines for creating and parsing
57 lightweight resolver no-op request and response messages.
59 The no-op message is analogous to a \fBping\fR packet:
60 a packet is sent to the resolver daemon and is simply echoed back.
61 The opcode is intended to allow a client to determine if the server is
64 There are four main functions for the no-op opcode.
65 One render function converts a no-op request structure \(em
66 \fBlwres_nooprequest_t\fR \(em
67 to the lighweight resolver's canonical format.
68 It is complemented by a parse function that converts a packet in this
69 canonical format to a no-op request structure.
70 Another render function converts the no-op response structure \(em
71 \fBlwres_noopresponse_t\fR
72 to the canonical format.
73 This is complemented by a parse function which converts a packet in
74 canonical format to a no-op response structure.
76 These structures are defined in
81 #define LWRES_OPCODE_NOOP 0x00000000U
84 lwres_uint16_t datalength;
86 } lwres_nooprequest_t;
89 lwres_uint16_t datalength;
91 } lwres_noopresponse_t;
94 Although the structures have different types, they are identical.
95 This is because the no-op opcode simply echos whatever data was sent:
96 the response is therefore identical to the request.
98 \fBlwres_nooprequest_render()\fR uses resolver
99 context \fIctx\fR to convert no-op request structure
100 \fIreq\fR to canonical format. The packet header
101 structure \fIpkt\fR is initialised and transferred to
102 buffer \fIb\fR. The contents of
103 \fI*req\fR are then appended to the buffer in
104 canonical format. \fBlwres_noopresponse_render()\fR
105 performs the same task, except it converts a no-op response structure
106 \fBlwres_noopresponse_t\fR to the lightweight resolver's
109 \fBlwres_nooprequest_parse()\fR uses context
110 \fIctx\fR to convert the contents of packet
111 \fIpkt\fR to a \fBlwres_nooprequest_t\fR
112 structure. Buffer \fIb\fR provides space to be used
113 for storing this structure. When the function succeeds, the resulting
114 \fBlwres_nooprequest_t\fR is made available through
116 \fBlwres_noopresponse_parse()\fR offers the same
117 semantics as \fBlwres_nooprequest_parse()\fR except it
118 yields a \fBlwres_noopresponse_t\fR structure.
120 \fBlwres_noopresponse_free()\fR and
121 \fBlwres_nooprequest_free()\fR release the memory in
122 resolver context \fIctx\fR that was allocated to the
123 \fBlwres_noopresponse_t\fR or \fBlwres_nooprequest_t\fR
124 structures referenced via \fIstructp\fR.
127 The no-op opcode functions
128 \fBlwres_nooprequest_render()\fR,
129 \fBlwres_noopresponse_render()\fR
130 \fBlwres_nooprequest_parse()\fR
132 \fBlwres_noopresponse_parse()\fR
138 if memory allocation fails.
139 LWRES_R_UNEXPECTEDEND
140 is returned if the available space in the buffer
142 is too small to accommodate the packet header or the
143 \fBlwres_nooprequest_t\fR
145 \fBlwres_noopresponse_t\fR
147 \fBlwres_nooprequest_parse()\fR
149 \fBlwres_noopresponse_parse()\fR
151 LWRES_R_UNEXPECTEDEND
152 if the buffer is not empty after decoding the received packet.
153 These functions will return
157 in the packet header structure
158 \fBlwres_lwpacket_t\fR
159 indicate that the packet is not a response to an earlier query.
162 \fBlwres_packet\fR(3)