Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / lwres / man / lwres_noop.3
1 .\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001  Internet Software Consortium.
3 .\"
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.
7 .\"
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.
15 .\"
16 .\" $Id: lwres_noop.3,v 1.14.2.2 2004/03/15 04:45:04 marka Exp $
17 .\"
18 .TH "LWRES_NOOP" "3" "Jun 30, 2000" "BIND9" ""
19 .SH NAME
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
21 .SH SYNOPSIS
22 \fB#include <lwres/lwres.h>
23 .sp
24 .na
25 lwres_result_t
26 lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
27 .ad
28 .sp
29 .na
30 lwres_result_t
31 lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
32 .ad
33 .sp
34 .na
35 lwres_result_t
36 lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);
37 .ad
38 .sp
39 .na
40 lwres_result_t
41 lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);
42 .ad
43 .sp
44 .na
45 void
46 lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp);
47 .ad
48 .sp
49 .na
50 void
51 lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp);
52 .ad
53 \fR
54 .SH "DESCRIPTION"
55 .PP
56 These are low-level routines for creating and parsing
57 lightweight resolver no-op request and response messages.
58 .PP
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
62 operational or not.
63 .PP
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.
75 .PP
76 These structures are defined in
77 \fIlwres/lwres.h\fR.
78 They are shown below.
79 .sp
80 .nf
81 #define LWRES_OPCODE_NOOP       0x00000000U
82
83 typedef struct {
84         lwres_uint16_t  datalength;
85         unsigned char   *data;
86 } lwres_nooprequest_t;
87
88 typedef struct {
89         lwres_uint16_t  datalength;
90         unsigned char   *data;
91 } lwres_noopresponse_t;
92 .sp
93 .fi
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.
97 .PP
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
107 canonical format.
108 .PP
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
115 \fI*structp\fR.
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.
119 .PP
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.
125 .SH "RETURN VALUES"
126 .PP
127 The no-op opcode functions
128 \fBlwres_nooprequest_render()\fR,
129 \fBlwres_noopresponse_render()\fR
130 \fBlwres_nooprequest_parse()\fR
131 and
132 \fBlwres_noopresponse_parse()\fR
133 all return
134 LWRES_R_SUCCESS
135 on success.
136 They return
137 LWRES_R_NOMEMORY
138 if memory allocation fails.
139 LWRES_R_UNEXPECTEDEND
140 is returned if the available space in the buffer
141 \fIb\fR
142 is too small to accommodate the packet header or the
143 \fBlwres_nooprequest_t\fR
144 and
145 \fBlwres_noopresponse_t\fR
146 structures.
147 \fBlwres_nooprequest_parse()\fR
148 and
149 \fBlwres_noopresponse_parse()\fR
150 will return
151 LWRES_R_UNEXPECTEDEND
152 if the buffer is not empty after decoding the received packet.
153 These functions will return
154 LWRES_R_FAILURE
155 if
156 pktflags
157 in the packet header structure
158 \fBlwres_lwpacket_t\fR
159 indicate that the packet is not a response to an earlier query.
160 .SH "SEE ALSO"
161 .PP
162 \fBlwres_packet\fR(3)