PageRenderTime 71ms CodeModel.GetById 61ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/contrib/bind9/lib/lwres/man/lwres_noop.3

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 183 lines | 183 code | 0 blank | 0 comment | 0 complexity | 19d83531ad2942a1a24f2ab2768f8076 MD5 | raw file
  1.\" Copyright (C) 2004, 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC")
  2.\" Copyright (C) 2000, 2001 Internet Software Consortium.
  3.\" 
  4.\" Permission to use, copy, modify, and/or 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$
 17.\"
 18.hy 0
 19.ad l
 20.\"     Title: lwres_noop
 21.\"    Author: 
 22.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
 23.\"      Date: Jun 30, 2000
 24.\"    Manual: BIND9
 25.\"    Source: BIND9
 26.\"
 27.TH "LWRES_NOOP" "3" "Jun 30, 2000" "BIND9" "BIND9"
 28.\" disable hyphenation
 29.nh
 30.\" disable justification (adjust text to left margin only)
 31.ad l
 32.SH "NAME"
 33lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free \- lightweight resolver no\-op message handling
 34.SH "SYNOPSIS"
 35.nf
 36#include <lwres/lwres.h>
 37.fi
 38.HP 40
 39.BI "lwres_result_t lwres_nooprequest_render(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
 40.HP 41
 41.BI "lwres_result_t lwres_noopresponse_render(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
 42.HP 39
 43.BI "lwres_result_t lwres_nooprequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_nooprequest_t\ **" "structp" ");"
 44.HP 40
 45.BI "lwres_result_t lwres_noopresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_noopresponse_t\ **" "structp" ");"
 46.HP 29
 47.BI "void lwres_noopresponse_free(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ **" "structp" ");"
 48.HP 28
 49.BI "void lwres_nooprequest_free(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ **" "structp" ");"
 50.SH "DESCRIPTION"
 51.PP
 52These are low\-level routines for creating and parsing lightweight resolver no\-op request and response messages.
 53.PP
 54The no\-op message is analogous to a
 55\fBping\fR
 56packet: a packet is sent to the resolver daemon and is simply echoed back. The opcode is intended to allow a client to determine if the server is operational or not.
 57.PP
 58There are four main functions for the no\-op opcode. One render function converts a no\-op request structure \(em
 59\fBlwres_nooprequest_t\fR
 60\(em to the lighweight 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 \(em
 61\fBlwres_noopresponse_t\fR
 62to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a no\-op response structure.
 63.PP
 64These structures are defined in
 65\fIlwres/lwres.h\fR. They are shown below.
 66.PP
 67.RS 4
 68.nf
 69#define LWRES_OPCODE_NOOP       0x00000000U
 70.fi
 71.RE
 72.sp
 73.PP
 74.RS 4
 75.nf
 76typedef struct {
 77        lwres_uint16_t  datalength;
 78        unsigned char   *data;
 79} lwres_nooprequest_t;
 80.fi
 81.RE
 82.sp
 83.PP
 84.RS 4
 85.nf
 86typedef struct {
 87        lwres_uint16_t  datalength;
 88        unsigned char   *data;
 89} lwres_noopresponse_t;
 90.fi
 91.RE
 92.sp
 93.PP
 94Although 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.
 95.PP
 96\fBlwres_nooprequest_render()\fR
 97uses resolver context
 98\fIctx\fR
 99to convert no\-op request structure
100\fIreq\fR
101to canonical format. The packet header structure
102\fIpkt\fR
103is initialised and transferred to buffer
104\fIb\fR. The contents of
105\fI*req\fR
106are then appended to the buffer in canonical format.
107\fBlwres_noopresponse_render()\fR
108performs the same task, except it converts a no\-op response structure
109\fBlwres_noopresponse_t\fR
110to the lightweight resolver's canonical format.
111.PP
112\fBlwres_nooprequest_parse()\fR
113uses context
114\fIctx\fR
115to convert the contents of packet
116\fIpkt\fR
117to a
118\fBlwres_nooprequest_t\fR
119structure. Buffer
120\fIb\fR
121provides space to be used for storing this structure. When the function succeeds, the resulting
122\fBlwres_nooprequest_t\fR
123is made available through
124\fI*structp\fR.
125\fBlwres_noopresponse_parse()\fR
126offers the same semantics as
127\fBlwres_nooprequest_parse()\fR
128except it yields a
129\fBlwres_noopresponse_t\fR
130structure.
131.PP
132\fBlwres_noopresponse_free()\fR
133and
134\fBlwres_nooprequest_free()\fR
135release the memory in resolver context
136\fIctx\fR
137that was allocated to the
138\fBlwres_noopresponse_t\fR
139or
140\fBlwres_nooprequest_t\fR
141structures referenced via
142\fIstructp\fR.
143.SH "RETURN VALUES"
144.PP
145The no\-op opcode functions
146\fBlwres_nooprequest_render()\fR,
147\fBlwres_noopresponse_render()\fR
148\fBlwres_nooprequest_parse()\fR
149and
150\fBlwres_noopresponse_parse()\fR
151all return
152\fBLWRES_R_SUCCESS\fR
153on success. They return
154\fBLWRES_R_NOMEMORY\fR
155if memory allocation fails.
156\fBLWRES_R_UNEXPECTEDEND\fR
157is returned if the available space in the buffer
158\fIb\fR
159is too small to accommodate the packet header or the
160\fBlwres_nooprequest_t\fR
161and
162\fBlwres_noopresponse_t\fR
163structures.
164\fBlwres_nooprequest_parse()\fR
165and
166\fBlwres_noopresponse_parse()\fR
167will return
168\fBLWRES_R_UNEXPECTEDEND\fR
169if the buffer is not empty after decoding the received packet. These functions will return
170\fBLWRES_R_FAILURE\fR
171if
172\fBpktflags\fR
173in the packet header structure
174\fBlwres_lwpacket_t\fR
175indicate that the packet is not a response to an earlier query.
176.SH "SEE ALSO"
177.PP
178\fBlwres_packet\fR(3)
179.SH "COPYRIGHT"
180Copyright \(co 2004, 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC")
181.br
182Copyright \(co 2000, 2001 Internet Software Consortium.
183.br